Skip to content

Commit adb184c

Browse files
committed
Add Unix equivalents table
1 parent b8f6f12 commit adb184c

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ examples/cat2/cat2
44
examples/echo/echo
55
examples/head/head
66
examples/visitors/visitors
7+
.vscode/settings.json

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,25 @@ func main() {
187187

188188
(Thanks to Lucas Bremgartner for suggesting this example. You can find the complete [program](examples/visitors/main.go), along with a sample [logfile](examples/visitors/access.log), in the [`examples/visitors/`](examples/visitors) directory.)
189189

190+
## Quick start: Unix equivalents
191+
192+
If you're already familiar with shell scripting and the Unix toolset, here is a rough guide to the equivalent `script` operation for each listed Unix command.
193+
194+
|Unix / shell|`script` equivalent|
195+
|---|---|
196+
|(any program name)|`Exec()`|
197+
|`>`|`WriteFile()`|
198+
|`>>`|`AppendFile()`|
199+
|`$*`|`Args()`|
200+
|`cat`|`File()` / `Concat()`|
201+
|`cut`|`Column()`|
202+
|`echo`|`Echo()`|
203+
|`grep`|`Match()` / `MatchRegexp()`|
204+
|`grep -v`|`Reject()` / `RejectRegexp()`|
205+
|`head`|`First()`|
206+
|`uniq -c`|`Freq()`|
207+
|`wc -l`|`CountLines()`|
208+
190209
## Sources, filters, and sinks
191210

192211
`script` provides three types of pipe operations: sources, filters, and sinks.

0 commit comments

Comments
 (0)