I think the
& in the end of the command line is not what you intended according to the description of your question. In this case, you're putting xterm into the background and keeps the script running, but there's nothing to run after xterm. You might want to put the
& before the finishing quote, inside the executing comma. I can't guarantee it will work, however, as I'm unsure about the xterm behavior and parameters and about how TWM works. If it does not work, I'll show an example of how to do it in a standard shell, which might be reproducible to the context you're using it through a separate script.
As an example of how to test and implement that, I have created two scripts in my
/tmp/ directory. The first one,
runbg.sh, contains the expected functionality:
The second script,
/tmp/infiniteloop.sh, is a way to test if it's working as expected, it's an infinite loop with a sleeping timer appending every iteration the current date to the file
while true; do
date >> /tmp/infiniteloop.tmp
If you then run
/tmp/runbg.sh, and you type the command
/tmp/infiniteloop.sh, it's going to leave you back in the shell. You can check the
infiniteloop.sh script is still running through a
tail -f /tmp/infiniteloop.tmp, which will show you a new line with the current date every 30 seconds if you did everything right.
So, in your case, my suggestion is to write a separate shell script for reading the command and running it in the background, and then call the script in the TWM menu config file.