3 ms·
A few things that stood out to me: Apart from the "goto" command and a different "if" statement syntax, all of the examples would run in a modern Bash shell; n
by bewuethr 6y ago
A few things that stood out to me:
Apart from the "goto" command and a different "if" statement syntax, all of the examples would run in a modern Bash shell; not much has changed fundamentally.
There seem to be no comments, and the argument for the no-op ":" is used for this purpose instead.
Using the argument of ":" as the label for the "goto" command reminded me of sed, which does exactly the same (and probably was influenced by it):
sed ': label
s/x/y/
/x/b label'
loops over the "s/x/y/" command until the pattern space doesn't match "/x/" any longer. (Just for illustration - this could be replaced by a single global substitution, of course.)
"goto" and labels are also the replacement for all the looping constructs we're used to today.
The differentiation between source/filter/sink types of programs makes so much sense, and while maybe obvious, I've never seen it described this clearly. Descriptions of the composability of Unix programs often focus on the filter aspect of programs.
- asicsp 6y agoyou can also use `t` command instead of `/x/b` or `//b` $ echo 'coffining' | sed ':d s/fin//; td' cog $ echo 'coffining' | sed ':d s/fin//; //b d' cog
- deleted 6y ago[deleted]