You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test: Expected a combining operator like '-a' at index 2 encountered when using test with -o to combine two string comparisons #5186
You've run into a horrible edge-case of the combination of shell variable expansion and the behaviour of test, which other shells suffer from too. The first argument is expanded, so your command looks like this:
test -r = -r -o -r = --dependencies
As test -r is a valid action, there is no way of test knowing which of the arguments are operators and which are parameters.
Activity
zanchey commentedon Sep 14, 2018
You've run into a horrible edge-case of the combination of shell variable expansion and the behaviour of
test, which other shells suffer from too. The first argument is expanded, so your command looks like this:As
test -ris a valid action, there is no way oftestknowing which of the arguments are operators and which are parameters.There are two ways to solve this:
"x$var" = "x-r"- see https://stackoverflow.com/questions/174119/why-do-shell-script-comparisons-often-use-xvar-xyesargparseinstead, which provides a more user-friendly interface.JBlaschke commentedon Sep 17, 2018
Great! thank you... it makes sense now!
quackduck commentedon Sep 9, 2020
@zanchey Why doesn't
if test "$argv[1]" = "--update"throw the same error?zanchey commentedon Sep 9, 2020
--updateis not a recognised flag fortest.quackduck commentedon Sep 9, 2020
Why would that matter?
Autocomplete virtualenv names for 'vex --remove'