Reputation: 1101
I have script1
which calls script2
which contains an echo statement. I want script1
to send the echo returned by the script2
to a named_pipe.
Is there a way to do it without having to change the code of script2? Like "capturing" the echo statements?
SCRIPT1:
...
case ${input_args[0]} in
SCRIPT2)
./SCRIPT2.sh ${input_args[1]};;
...
SCRIPT2:
echo "OK: done!"
Upvotes: 1
Views: 382
Reputation: 9311
Just redirect the output to the named pipe:
./SCRIPT2.sh ${input_args[1]} >"my_named_pipe"
Named pipes are just like files in this sense.
Upvotes: 2