Hi,
Is there a way in Korn Shell that I can run multiple commands stored as a semi-colon separated string, e.g.,
# vs="echo a; echo b;"
# $vs
a; echo b;
I want to be able to store commands in a variable, then run all of it once and pipe the whole output to another program without using any temporary file or storing the individual commands outputs in another shell variable.
I seem to be able to do this directly on command line prompt but why not using a variable:
> ( echo a; echo b ) | wc -l
2
> vs="( echo a; echo b )"
> $vs | wc -l
bash: (: command not found
0
> `$vs` | wc -l
bash: (: command not found
0
>
Thanks for any help.