How to determine if a bash variable is empty?

Posted by Brent on Server Fault See other posts from Server Fault or by Brent
Published on 2009-05-12T17:54:48Z Indexed on 2010/05/20 21:02 UTC
Read the original article Hit count: 156

Filed under:
|

What is the best way to determine if a variable in bash contains ""?

I have heard it recommended that I do if [ "x$variable" = "x" ]

Is that the correct way? (there must be something more straightforward)

© Server Fault or respective owner

Related posts about bash

Related posts about scripting