Answer the question
In order to leave comments, you need to log in
How to run in background-e and then get a response?
Here is what I tried to write.
I wanted to do the following in this (so that I can run a script from the first terminal, where the output will go to the second, and at the end I will see the answer in the first terminal that it is completed)
Ideally, I would even like to get the output of the result already.
Here is the code (anyone have any ideas or hints)
#!/bin/bash
E_BADARGS=100
if [ ! -n $"1" ]
then
echo "Usage: `basename $0` \" destination ip address\" \"Test time arg\"
exit $E_BADARGS
fi
address=$1
flood_time=$2
( `ping -f -s 1500 -w $flood_time $address > /dev/tty2 echo "Test is done"
exit 0
Answer the question
In order to leave comments, you need to log in
If the script is run in the background (./script &), then what will be written in the echo argument without redirects will go to this terminal, even though the process will still be spinning in the background.
If you want the script to still work if you close the terminal, you can redirect the outputs to /dev/null, take the input from /dev/zero and call disown , or run the script with nohup.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question