3

I make a shortcut on the desktop to run some commands in a terminal.
I click it and the terminal window just opens and closes!

Also, I would like to be able to have the script open a second terminal which will run some more commands and also remain open.

tshepang
  • 12,111
  • 21
  • 91
  • 136
Nissim Nanach
  • 1,925
  • 2
  • 16
  • 18

1 Answers1

1

Create a script by your favorite method, e.g. right-click on your desktop > Create Document > name it 'test.sh' > Right click on the document > Properties > Permissions > Allow executing (or use chmod from terminal)

Open it for editing with gedit, KWrite, vt etc.

Here is a script which will run some commands in the parent terminal, run two more commands in a child terminal, and leave both terminals open!

#!/bin/bash
echo hello
# open a child window, run two commands in it, and leave the child window open
mate-terminal -e "bash -c \"echo foo; echo bar; exec bash\""  
echo "keep this open"
# leave the parent window open
read 

Save the file, click and select "Run in Terminal."

An alternate way to keep the terminal windows from closing is: Open a terminal > Edit menu > Profile Preferences > Title and Command > When Command Exits > Change from "Exit the terminal" to "HOLD THE TERMINAL OPEN"

Line 4 in the script is thanks to
Avoid gnome-terminal close after script execution?

Community
  • 1
  • 1
Nissim Nanach
  • 1,925
  • 2
  • 16
  • 18