It is possibly to do this automatically

Have the menu item call a shell script which does the tasks you want and then have it wait for a <enter> to continue by having something like:

echo "Press ENTER to continue ..."
read in

When the script ends it should close the shell window ...

(off the top of my head and without a Linux box in front of me)
 
You want the terminal window left open for what ?

If it is just to see the progress or any errors you can just redirect stderr and stdout to a log file or nohup the command and then check the nohup.out file to see how it is going.

Bit more info would make it easier to tailor the answer ;).

RB
 
Hi,

Which shell (sh/bash/ksh/csh etc) ?

Presuming bash until you advise different. Just taking a look now.

RB
 
Ok,

There is probably an easier way but the following may work.

1. Attach a menu item to a script which sets and exports an environment variable (i.e. var='run_custom_script)

2. The script then starts a shell which should now contain the set variable.

3. You user startup scripts (.profile/.cshrc/.kshrc etc) can look for this variable and if found then run your scripts you need running.

4. Once the scripts finish the shell should still be there for anything else you want to do with it.

5. On exiting the shell, control goes back to the underlying script which can then unset the variable and exit.

As I said, there is probably a simpler way but the above should work with minor tweeking.

RB
 
Presuming you just want to be able to quickly view the output of the script(s)/commands, and know how to create a shell script etc - then the read command is the functional equivalent of 'pause' in Windows:

Code:
read -p "Press any key to continue…"
 
You could just call the gnome terminal and pass it your commands to run as arguments, and also give it the switch to stay open once done.

i.e

Code:
#!/bin/sh
CMD_STRING = "ls -la && echo leet"
gnome-terminal -e $CMD_STRING --window-with-profile=PROFILENAME

Save that as your_script.sh and chmod+x it, add it to your gnome start menu.

Now in an open terminal, navigate to Edit->Preferences. Click on the "Title and Command" tab. There's a spinbox labeled "when command exits", change it from "exit the terminal" to "hold the terminal open". Save this as a profile and match the name of it to the script argument above.

When run that should run a gnome-terminal window, execute your command string and leave the term open for future work. That's off the top of my head, nothing to test it on right now so it could epic fail.
 
Back
Top Bottom