How can I make my shell scripts run in a new console automatically?

Solution 1:

You could run your script in another terminal emulator window, I suppose gnome-terminal with the command

gnome-terminal -x ./script

You could simplify the process defining a function in your ~/.bashrc

start() {
  gnome-terminal -x "$@"
}

where can choose the name you prefer instead of start. You use the function in this way

start ./command arg1 arg2

(you need to restart the terminal for the shell to know about the new function).

As you can see, there is a little problem, the window closes once the command terminates. To avoid this you could wrap your command in a shell script and add a last line with a read command:

#!/bin/sh
# script

./command arg1 arg2
read answer

Then when you call

start ./script

it will not closes, waiting for your input.

Unfortunately, It is difficult to automate this in the start function.