How to open multiple shells while the scripts keeps running.

Hello, I've tried for a while now to run a bash script that continues to the end, while opening new shells as needed.

I've tried


 xterm -e "somecommand"; &
 xterm -e " somecommand";

I've also tried

screen -S "somecommand"; &
screen -S "somecommand";

All without any luck, they both work but only open a new shell once the command has finished or I kill the process.
I really need the script to open multiple shells at the same time and continue till the end.

Any help or direction will be much appreciated.

Regards

You might want to post your script. I tried the following:

#!/bin/bash
echo "starting"
xterm -e "sleep 5"; &
echo "see the xterm"
ls
sleep 1
exit

And got a syntax error near unexpected token "&" - when I removed the ; and moved the & over one, then it ran with no issue (with the xterm popping up running the command and the original script continuing on and exiting before the xterm went away which I believe is what you are looking for)

Thanks RTM, after removing the ";" and moveing the "&" over it ran like a charm, all I have to do now is play around with "sleep" so the shell opens at the correct time.
Thanks again.
Regards

Hi there,

I've been trying to do something simular as discriber here with csh scripting with AIX.

When I excecute: xterm -e "sleep 5" with or without ; or & the xterm window opens but no command is being excecuted.

Any more suggestions?

Thanks for any help!
Robbert

I getting the error as

xterm: Can't execvp ls -ltr

any one has ideas abt this??

For Nilesrex: The error you received is should show more information.

In your example, is there anything more to the error message?

(Also, please start a new thread next time you have a question instead of hijacking someone else's thread - it makes it harder to answer everyone involved. Thanks.)