How to launch a terminal from script and another script to run in terminal
251
Solution 1
Run a non-interactive shell that runs your script and then replaces itself with an interactive bash shell.
gnome-terminal --working-directory="$HOME/randomdir" -x bash -c './randomscript; exec bash' &
Solution 2
gnome-terminal --working-directory=randomdir
Is this what you are looking for?
By the way, man gnome-terminal
should help :)
EDIT:
However, if you want to keep the terminal open you can do this:
gnome-terminal --working-directory=randomdir -e COMMAND #launch the command - terminal will close
gnome-terminal --working-directory=randomdir #open a new terminal with the same default path
These 2 commands added in your script.
Related videos on Youtube
Author by
Hadi
Updated on September 18, 2022Comments
-
Hadi over 1 year
I installed the
Hadoop 2.7.2
independently in single node mode.I created a
testfile.txt
successfully with this contentHello world in HDFS!
But when I want to append lines to this file with this command:
bin/hadoop fs -appendToFile extraFile.txt testfile.txt
it throws this error:
appendToFile: Not Supported
I'm using
ubuntu server 14.04
on my virtual machine. Any comment is appreciated :)-
mx7 over 10 yearsyou might looking for askubuntu.com/questions/3359/…
-
-
ike over 10 yearsThis is not what I'm looking for, I want to launch another script in the newly opened terminal, and keep the terminal open after that script exits.
-
mx7 over 10 yearsfrom the OP "By the way I tried
cd ~/rockbox && gnome-terminal -e "./randomscript.sh"&
and that opened the script, but closed the terminal after the script exited." -
ike over 10 yearsThis works, but I like the other answer better because it keeps the same window, and the other commands in the file still run with their solution.(I couldn't get your's to do that, even with adding the &'s at the end of lines.)
-
ike over 10 yearsI got it to run like I wanted it to by
gnome-terminal --working-directory=randomdir -e ./randomscript.sh && gnome-terminal --working-directory=randomscript&