octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

test "$foo" = "$bar" vs test x"$foo" = x"$bar"


From: Jordi Gutiérrez Hermoso
Subject: test "$foo" = "$bar" vs test x"$foo" = x"$bar"
Date: Wed, 25 Feb 2015 11:27:56 -0500

re: bug #44367.

I need a little help with my shell scripting.

What's the reason to have

    test x"$foo" = x"$bar"

vs

    test "$foo" = "$bar"

?

It was my understanding is that the intent of the former is to handle
the case where $foo or $bar is empty, but I thought the quotes handled
that.

That is, I thought you needed to either do

   test x$foo = x$bar

or

   test "$foo" = "$bar"

but having both the leading x and the quotes is redundant.

- Jordi G. H.






reply via email to

[Prev in Thread] Current Thread [Next in Thread]