I have a command line utility which needs a text file (to format the output) as argument. I only need the pure value and no formatting, so I'd like to have a one-line script to get the value.
The text file
vclient -h 10.0.0.131:3002 -t template.file -g getTempKist
vclient -h 10.0.0.131:3002 -t $(echo '\$1') -g getTempKist
You can try two things:
First, you can probably use stdin for the input like this:
echo '$1' | vclient -h 10.0.0.131:3002 -t - -g getTempKist
Some tools support the special value
- for filename arguments where
- stands for stdin. However this depends on the implementation of the command.
Second thing you can use if your shell (like
zsh) supports this is to use process substitution:
vclient -h 10.0.0.131:3002 -t <(echo '$1') -g getTempKist