Bash test and comparison functions

I actually write scripts in bash so infrequently that I’m embarrassed to say I often have to look this crap up when I need to use it. This is a good reference.

Are you confused by the plethora of testing and comparison options in the Bash shell? This tip helps you demystify the various types of file, arithmetic, and string tests so you will always know when to use test, [ ], [[ ]], (( )), or if-then-else constructs.


Leave a Reply

Your email address will not be published. Required fields are marked *