linked

Unix shell if statement explained ⇝

  Wynn Netherland • 2014-01-09

Pat Brisbin gives one of the most approachable explanations of the Unix shell's if statement that I've seen.

if [ "string" != "other string" ]; then
  # same as if test "string" != "other string"; then
fi

Unfortunately, many users come across this usage first and assume the brackets are part of if itself. This can lead to some nonsensical statements.

I will always hold my nose every time I type fi, but I've grown more fond of shell scripting the last few years.

Linked from: http://robots.thoughtbot.com/the-unix-shells-humble-if

Wynn Netherland
Wynn Netherland

VP of Engineering at Abstract, team builder, DFW GraphQL meetup organizer, platform nerd, author, and Jesus follower.