Skip to Content
Navigation:

A stick figure smiling

If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!

browse more comics!
read the transcript!

panel 1: shell scripts have a lot of brackets

person: “here’s a cheat sheet to help you identify them all! we’ll cover the details later.

panel 2: (cd ~/music; pwd)

a group of commands. runs in subshell.

panel 3: {cd ~/music; pwd}

a group of commands. runs the same shell.

panel 4: VAR=$(cat file.txt)

run a command & assign output (similar to backticks ``)

panel 5: x=(1 2 3)

creates an array

panel 6: x=$((2+2))

$(()) does arithmetic

panel 7: a{.png,.svg}

expands to a.png a.svg. it’s called “brace expansion”

panel 8: if [ ... ]

[ is a program (aka test) that evaluates statements

panel 9: if [[ ... ]]

[[ is bash syntax. it’s more powerful than [

panel 10: ${var}

another way to reference the variable $var

panel 11: ${var//search/replace}

${...} supports search/replace and lots more fancy things

Saturday Morning Comics!

Want another comic like this in your email every Saturday? Sign up here!

I'll send you one of my favourite comics from my archives every Saturday.
© Julia Evans 2020 | All rights reserved (see licensing)