![A stick figure smiling](/images/welcome.jpg)
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!
![Image of a comic. To read the full HTML alt text, click "read the transcript".](/images/uploads/brackets-cheatsheet.png)
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!