This is most likely a stupid mistake I made somewhere but I just cannot seem to figure out what's happening. Hoping I can find some help here.
I have a script callee.sh
that expects some optional variable $1,$2,$3
etc... and it does a bunch of echo in the script (so, multiple lines of output) I only want to last line as the result. The other lines are just debug status reports.
When try to assign the result to a variable like this
result=`./callee.sh | tail -n 1`
It works perfectly
However, if it takes parameter
result=`./callee.sh param1 param2 param2 | tail -n 1`
The code would block for ever, never entering callee.sh
Just for comparsion I tried running
result=`./callee.sh`
, This works but all the lines are append to one line (that's fine)
but running
result=`./callee.sh param1 param2 param2`
also hangs for ever. Never entering callee.sh
What did I do wrong? What should I do instead?