I have a Python script which prints \a
(ASCII Bell character) when some event occurs. The problem that I'm facing currently is that the script closes after I close the terminal which was executing the script. On going through similar questions posted on the site, most answers suggest using the nohup
command. The problem with using nohup
is that the output is redirected to a nohup.out file. Because of this, the ASCII Bell sound will not ring as the output is now redirected to somewhere else.
I have tried the following:
Using &
. This stops the bell as soon as I close the terminal:
python3 script.py &
Using nohup
. Redirects the output and can't hear the bell at all:
nohup python3 script.py &
Using disown
also didn't work. The script continued till I closed the terminal.
python3 script.py &
disown %1
Is there anyway to overcome this and run the script in background after closing the terminal and still hear the bell sound?