If you just want to watch the output from the script, you can redirect the output from your script to a file and then watch that file in another window:
# Run the script and log all output to a file
./watch.sh &> /var/log/watch.log &
# Watch the file, possibly in another terminal window
tail -f /var/log/watch.log
In my experience, this behavior (writing to a log file) is pretty typical. I don't recall ever having used a command-line application that started spawning other terminal windows.
That said, if you really want to open a new terminal window from the command-line then that will depend on the terminal application. There is a good post about this on the AskUbuntu StackExchange site:
In particular see this answer. For example, for the Gnome terminal you might use a command such as the following:
gnome-terminal -x sh -c "./watch.sh; bash"
If you want to programmatically determine which terminal application is being used, you might want to refer to the following AskUbuntu post:
The accepted solution there defines the following function:
which_term(){
term=$(perl -lpe 's/\0/ /g' \
/proc/$(xdotool getwindowpid $(xdotool getactivewindow))/cmdline)
## Enable extended globbing patterns
shopt -s extglob
case $term in
## If this terminal is a python or perl program,
## then the emulator's name is likely the second
## part of it
*/python*|*/perl* )
term=$(basename "$(readlink -f $(echo "$term" | cut -d ' ' -f 2))")
version=$(dpkg -l "$term" | awk '/^ii/{print $3}')
;;
## The special case of gnome-terminal
*gnome-terminal-server* )
term="gnome-terminal"
;;
## For other cases, just take the 1st
## field of $term
* )
term=${term/% */}
;;
esac
version=$(dpkg -l "$term" | awk '/^ii/{print $3}')
echo "$term $version"
}
xterm -e /path/to/script
. Which terminal emulator are you using? (And what distro?)$TERM
is not your terminal emulator. (e.g. I getxterm-256color
even though I'm running Terminator.) What application are you actually launching to start the emulator? Also, you should be able to install any of those alternatives in Mint./bin/bash
is the shell, not the terminal. I've posted an answer based on xfce4-terminal.