an executable expects command-line parameters in the format:
-varname "[64]"
Need to wrap it as an environment variable so the executable can be launched by another tool, so I tried:
> setenv PARAM '-varname "[64]"'
> echo $PARAM
echo: No match.
I tried all kind of escapes but couldn't find how to enclose the original string into an environment variable.
Must mention that both the inner executable and the wrapper are inflexible in their expectations, e.g. the executable expects the variable as shown and the wrapper expects a string that it associates with an environment variable through 'setenv'.
Any hint?
Thanks!
You are setting it correctly, but the problem is how the shell expands the value of $PARAM.
As you know, a star at the command line is expanded by the shell to all the files in the current directory.
The result of shell expansion is subsequently used as the argument to
echo.There are additional wildcard/glob patterns allowed at the command line. Square brackets define character class. To echo all files containing either a
4or a6:To echo all files named exactly 4 or 6.
In the above example, if no files are named exactly 4 or 6, then you'll get
echo: No match.Solution: use printenv
Note that
PARAM, not$PARAMis the argument toprintenv. This avoid shell expansion of$PARAM.