Skip to main content
edited tags
Link
chicks
  • 3.8k
  • 10
  • 28
  • 37

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

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

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

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)

What is the best way to determine if a variable in bash is empty ("")?

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

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

Tweeted twitter.com/#!/ServerFault/status/586084144305811456

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" ]if [ "x$variable" = "x" ]

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

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)

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)

Question Protected by Chris S
Source Link
Brent
  • 23.5k
  • 19
  • 71
  • 103
Loading