Bash by example, Part 2
More bash programming fundamentals
From the developerWorks archives
Date archived: April 18, 2019 | Last updated: February 18, 2013|First published: April 01, 2000In his introductory article on bash, Daniel Robbins walked you through some of the scripting language's basic elements and reasons for using bash. In this, the second installment, Daniel picks up where he left off and looks at bash's basic constructs like conditional (if-then) statements, looping, and more.
04 Jan 2013 - In response to reader comment, updated information in these sections: Accepting arguments, Conditional love, String comparison caveats, Looping constructs: "for", and Functions and namespaces.
18 Feb 2013 - In response to reader comment, updated the Common Bash comparisons table. In the row with an Operator value of "-f" and Meaning value of "Exists and is directory," changed Operator value to "-d" and [ -f "$myfile" ] character string to: [ -d "$mydir" ].
This content is no longer being updated or maintained. The full article is provided "as is" in a PDF file. Given the rapid evolution of technology, some content, steps, or illustrations may have changed.