I have a program "myprogram" and it waits for a enter key when run on console. After we press somekey it exits. I want to run this myprogram in background and ignore stdin input.
I have a smaple script,
sample.sh script
------
./myprogram &
exit 0
------
but when I run,
%sh sample.sh
some how myprogram gets some inputs from stdin and exits.. I want to stop it from getting any input from stdin so even after sample.sh exits myprogram continue to run.
Please suggest how I can update sample.sh script to achieve this.
You can connect the program's standard-input to /dev/null
:
./myprogram < /dev/null &
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With