shell scripting: nested subshell ++
- by jhon
Hi guys,
more than a problem, this is a request for "another way to do this"
actually, if a want to use the result from a previous command I into another one, I use:
R1=$("cat somefile | awk '{ print $1 }'" )
myScript -c $R1 -h123
then, a "better way"is:
myScript -c $("cat somefile | awk '{ print $1 }'" ) -h123
but, what if I have to use several times the result, let's say: using several times $R1, well the 2 options:
option 1
R1=$("cat somefile | awk '{ print $1}'")
myScript -c $R1 -h123 -x$R1
option 2
myScript -c $("cat somefile | awk '{ print $1 }'" ) -h123 -x $("cat somefile | awk '{ print $1 }'" )
do you know another way to "store" the result of a previous command/script and use it as a argument into another command/script?
thanks