Quantcast
Channel: When are arbitrary strings passed to test ambiguous - Unix & Linux Stack Exchange
Browsing latest articles
Browse All 2 View Live

Answer by Hauke Laging for When are arbitrary strings passed to test ambiguous

> [ -f = -a -a -a ] bash: [: argument expected > [ -f = -a -a x ] But: [ x-f = x-a -a -a ] doesn't work either although [ -a ] is fine.

View Article



When are arbitrary strings passed to test ambiguous

I came across this construct to test whether the shell variable $foo, which could contain any arbitrary string, matched foo: [ "x$foo" = "xfoo" ] The purpose of prefixing with x was never explained....

View Article
Browsing latest articles
Browse All 2 View Live




Latest Images