
Here's a preview from my zine, Bite Size Bash!! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!

read the transcript!
some bash features aren’t in the POSIX spec
Illustration of a smiling stick figure with curly hair.
Person: here are some examples! These won’t work in POSIX shells like dash
and sh
.
arrays
POSIX shells only have one array: $@
for arguments
[[ $DIR=/home/*]]
POSIX alternative: match strings with grep
[[ … ]]
POSIX alternative:
[ ... ]
diff <(./cmd1) <./cmd2)
this is called “process substitution”, you can use named pipes instead
the local Keyword
in POSIX shells, all variables are global
for ((i=0; i <3; i++))
sh
only has for x
in … loops, not C-style loops
a. {png, svg}
you’ll have to type
a.png a.svg
{1..5}
POSIX alternative:
$(seq 1 5)
$’\n’
POSIX alternative:
$(printf "\n")
${var//search/replace}
POSIX alternative:
pipe to sed
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!