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!
shell scripts have a lot of brackets
here’s a cheat sheet to help you identify them all! we’ll cover the details later.
(cd ~/music; pwd)
(...)
runs commands in a subshell.
VAR=$(cat file.txt)
$(COMMAND)
is equal to COMMAND
’S stdout
{ cd ~/music; pwd; }
(...)
groups commands. runs in the same process.
x=(1 2 3)
x=(...)
creates an array
x=$((2+2))
$(())
does arithmetic
if […]
/usr/bin/[
is a program that evaluates statements
<(COMMAND)
“process substitution”: an alternative to pipes
a{.png, .svg}
this expands to a.png a.svg
it’s called “brace expansion”
if [[ … ]]
[[
is bash syntax. it’s more powerful than [
${var//search/replace}
see page 21 for more about ${...}
!
Saturday Morning Comics!
Want another comic like this in your email every Saturday? Sign up here!