[D-community-offtopic] how to quote the pipe symbol in shell scripts?

Kamaraju S Kusumanchi raju.mailinglists at gmail.com
Sat May 28 12:14:36 UTC 2011


Jochen Schulz wrote:

> Kamaraju S Kusumanchi:
>> $cat quote_pipe_symbol.sh
>> #! /bin/sh
>> 
>> command="tail -n 3 cols.txt | cut -f 2-3 -d ','"
>> echo $command
>> $command
> 
> I cannot tell why executing "$command" doesn't work, but running "eval
> $command" works for me.
> 
> BTW: Be aware that your shebang-line points to /bin/dash by default on
> Debian. Your script will break if you use bashisms in the future.
> 
> J.

Thanks for all the replies! The "eval $command" works great. Just what I 
need.

-- 
Kamaraju S Kusumanchi
http://malayamaarutham.blogspot.com/




More information about the D-community-offtopic mailing list