Tech Reflect
  • Home
  • About This Site
  • Contact me
  • Search Icon
Flow control in bash

Flow control in bash

2018-02-16

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.


geeky, macOS tips

Post navigation

NEXT
Simple repeating command-line command
PREVIOUS
Moderately advanced searching in Mail
Comments are closed.

Get Monthly Updates

Recent Posts

  • Inserting random email sigs in Mail on iOS
  • Keep Instagram open to finish posting…
  • How I predicted the rise of Twitter, barely used it, and amassed 35,000 followers
  • Apple Books 2022, in pictures
  • Killing one bird with two-and-a-half stones in Mac OS X Mail

Categories

  • analog (1)
  • apple career (12)
  • apple inside (19)
  • apple stories (20)
  • bertrand serlet (3)
  • bugs (3)
  • essays (15)
  • geeky (21)
  • interviews (4)
  • iOS tips (4)
  • Mac OS X (7)
  • macOS tips (36)
  • personal (8)
  • predictions (1)
  • products (5)
  • prototypes (6)
  • scott forstall (7)
  • scripting (2)
  • siri (2)
  • steve jobs (16)
  • tim cook (1)
  • workplace (15)

Get Monthly Updates

About cricket


Me with Guiness the owl

25 years in tech. I like to write manifestos. I like to offer interesting tips. I like making fun of things. Everyone copes differently.

My Other Blogs

  • Free Range Parrots
  • Plucky Tree (personal)
© 2025   All Rights Reserved.