I had the following script to alert me when someone sends me mail:
cd /var/mail watch -g ls && cat end ./alert
end would be a blank file; when I am going home, I would modify the
end file from another shell, and the script would end due to the
I then realized that, rather than opening another shell, I could simply tell the script the time I'm going home, and it would modify the
end file by itself at that time. When I do this and send
watch into the background, the script terminates as expected. However, the shell starts all kinds of weird behaviour after the script has exited. Simplest buggy example:
( watch -g cat end ) & sleep 2 echo y >> end
I thought I would use a different application to avoid this bug. However, both
konsole seem to have this issue on my system (Debian).
I should add that running the above code directly from the command line does seem to work as expected. Only yields this weird behaviour when run from within a script.