5
I would like to know how to call a new terminal/xterm from within a command in the shell script, so that the shell script that called the other script keeps running non-stop.
Does anyone have any suggestions?
5
I would like to know how to call a new terminal/xterm from within a command in the shell script, so that the shell script that called the other script keeps running non-stop.
Does anyone have any suggestions?
3
If you are using the GNOME
as an interface, you can call a new terminal by calling the gnome-terminal
, see an example:
#!/bin/bash
readonly OUTRO_SCRIPT="hello1.sh"; # O script a ser executado
chmod +x $OUTRO_SCRIPT;
gnome-terminal -x bash -c "./$OUTRO_SCRIPT; exec $SHELL";
#Continua a execução do script
echo "Foo... ";
echo "....Bar";
To call the Terminal Emulator - xterm
:
xterm
Or:
x-terminal-emulator
If using XFCE
as an interface, you can call the terminal by running the xfce4-terminal
:
xfce4-terminal
If using KDE
as an interface, you can call the terminal by running the Konsole
:
Konsole
If using LXDE
as an interface, you can call the terminal by running the LXTerminal
:
lxterminal
Here you may find some information regarding Terminal that may be useful.
1
good night!
You don’t necessarily need another terminal, you can run multiple scripts at the same time.
Create the two script files, in the example I will inform as if it were index.sh and variables.sh
In the index.sh file will pull the variable.sh file as follows:
#!/bin/bash
. ./variaveis.sh # Executa e lê variáveis, funções, etc.
echo $var1
and in the file variables.sh will set all variables:
variables.sh
#!/bin/bash
var1="Esta variavel vem de outro arquivo!"
Both files must have execution permission so it will be necessary to run
chmod +x index.sh
chmod +x variables.sh
Run the index.sh file and see the magic happen.
$ ./index.sh
--EOF--
1
To call a background command (continue running non-stop), you use the command nohup [command] & to call the program or script.
nohup [./script.sh] &
In this case, the exits of the program will continue to be shown in the terminal you called. In order for this not to happen, you must redirect it to /dev/null.
nohup [./scrip.sh] > /dev/null &
Or maybe you want to redirect to a log file.
nohup [./script.sh] > ./saida.log &
I hope I’ve helped.
-1
Simple, type the command line below:
gnome-terminal -- . /example.sh
Or if your script is in a specific location type the path:
gnome-terminal -- Desktop/. /example.sh
Caption:
"gnome-terminal" -> calls a new terminal
"--" -> have the script run
"Desktop/.exemplo.sh -> path to the script or program
And what does your answer add to the answer from stderr? Or Everton?
Browser other questions tagged linux ubuntu shell-script
You are not signed in. Login or sign up in order to post.
Thank you @Qmechanic73
– Cesar Augusto Nogueira