Reputation: 131
I use Ubuntu for Windows 10.
My script (SendTrends.sh) runs all the time but sometimes I need to run antoher script (Historical+.sh) without stopping SendTrends.sh. The best option for me will be if Historical+.sh will poping up in another console and after its work, closes that console. But I will be happy with solution in single console if it will work fine. How can I do that?
Thanks for any kind of help.
Upvotes: 3
Views: 3952
Reputation: 493
There is several ways to do this, let me present you some
&
shell's control operatorYou can use the shell's control operator &
at the end of your command:
./Historical+.sh &
will launch your script in the background, letting your current console free to use.
You can see more on shell's control operators here.
There is two ways to do this, one close the console automatically at the end of the execution, and the other keep the bash open. Both have been found in this post (the first in the question, and the second in the accepted answer)
Using bash -lic "command"
should allow you to launch a new bash, execute the command in it, and then close the created bash.
bash --rcfile <(echo '. ~/.bashrc; your_command')
is the way to keep the console open
If you only need to run the command and close the console immediately without using it, maybe the solution with the shell's control operator is the more suitable in your case. Else you may consider using one of the two other options.
Upvotes: 5