Tech Reflect

Tech Reflect

Share this post

Tech Reflect
Tech Reflect
Flow control in bash

Flow control in bash

Chris Hynes - cricket's avatar
Chris Hynes - cricket
Feb 17, 2018
∙ Paid

Share this post

Tech Reflect
Tech Reflect
Flow control in bash
Share

It seems like whenever I want to write an if-then or case statement in bash, I spent an hour searching the web and end up finding 12 different suggested ways of doing it. I try them all and maybe one of them works if I’m lucky.

I happened to find what I think is a really great reference for this that has been a great resource for me:

Bash Scripting Tutorial – 5. If Statements

Things like string comparisons, inspecting files, boolean operations, and nested flow control are some of the topics covered. Sure, there is the official bash documentation mentions this stuff, but it’s very terse and doesn’t provide good examples, if at all.

Having said all this, I highly recommend writing command-line tools in Swift:

Creating command-line tool in Swift

Not only will you be increasing your knowledge of Swift, it’s much more powerful, more easily debuggable, and Apple makes a great IDE to help you along.

Keep reading with a 7-day free trial

Subscribe to Tech Reflect to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Christopher Hynes
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share