Sponsored Content
Top Forums Shell Programming and Scripting Problem run script inside a gnome-terminal Post 302660477 by jao_madn on Friday 22nd of June 2012 01:30:14 PM
Old 06-22-2012
Quote:
Originally Posted by Corona688
So you want the command to run, and then once the command finishes, drop to a shell?

That works when you type it because it doesn't hit EOF once startvm.bsh finishes -- there's already another shell running, waiting for the keyboard. But when you run it as a command, your program is the only thing running. It hits a very literal 'end of file', decides its time to quit, and when it does there's absolutely nothing left running at all -- causing the terminal to quit.

If you want it to run another shell after, tell it to run another shell after. Smilie

How about this?
Code:
gnome-terminal -x /bin/bash -c "/home/<location_script>/startvm.bsh ; exec /bin/bash"

A miniature shell-script on the commandline itself, telling it to run startvm.bsh first, then start a plain shell afterwards.
Thanks @corona688: I mean run gnome-terminal command which pop-up a gnome-terminal window. run & display the STDOUT of the startvm.bsh on the pop-up gnome-terminal for the purpose of displaying if command "vboxheadless ..." succesfully executed the VM then exit the script and then close the gnome-terminal window. Close all window(gnome-terminal) or shell etc. after displaying the STDOUT of the script but not affecting the command the script execute.

I already tried the command you give and succesfully powerof the vm and gnome-terminal won't close since another bash shell holding it. But as soon as the gnome-terminal close the same as the VM.(Its like sending a close signal to the command they executed before). I already tried putting "&" to background command but still no success.
 

10 More Discussions You Might Find Interesting

1. Linux

run script through terminal

for all friends i am using linux enterprise 4. i installed oracle 10g in user name oracle.at the end of install i got a pop up window saying that u should run the following scripts(root.sh,orainstRoot.sh) in terminal from root account(cui) without log out oracle account . how i can run these... (5 Replies)
Discussion started by: sadiquep
5 Replies

2. Shell Programming and Scripting

Problem with gnome-terminal

Hello everyone. This is my first post.:o Using Ubuntu 8.04 and bash 3.2.39 i'm trying to adapt my routine to this platform. So, this means forget xterm and use gnome-terminal (as default ubuntu terminal). EveryDay i need to connect to several servers, and i've made a Tcl'script to make this... (1 Reply)
Discussion started by: trutoman
1 Replies

3. Shell Programming and Scripting

Problem - gnome terminal shell scripting

I've a python script named rwe.py. I'm running the program in three separate terminals. If one of the executing program stops . I want to leave the terminal as it is so that i can see the error. i wrote a the below script and used cron to run it every one hour to check if the three programs are... (0 Replies)
Discussion started by: msteve2002
0 Replies

4. Shell Programming and Scripting

Set terminal width inside a shell script

Hi all, I have a shell script which uses "mailx -H" to get the subject of a email in a Linux system. However, the subject is truncated, and I think it has something to do with the terminal width because it only returns the first 80 characters of each line. I have tried "stty columns"... (7 Replies)
Discussion started by: mezzo
7 Replies

5. Shell Programming and Scripting

Is command line invocation of gnome-terminal to run more than one command possible?

Hello, I am trying to learn how to pass something more than a one-command startup for gnome-terminal. I will give an example of what I'm trying to do here: #! /bin/bash # #TODO write this for gnome and xterm USAGE=" ______________________________________________ ${0##*/} run... (0 Replies)
Discussion started by: Narnie
0 Replies

6. Shell Programming and Scripting

Run bash script without terminal

How can I make a bash script that keeps on running after I have closed the terminal? Or a script that runs without having the terminal window open? (1 Reply)
Discussion started by: locoroco
1 Replies

7. UNIX for Dummies Questions & Answers

Script to run a command in a new terminal

Hey, I am trying to write a script that will open all of my session windows, and then secure shell into the appropriate server in the new windows. Seems simple, but I cant get it to work! Please help! :confused: (1 Reply)
Discussion started by: sojo1024
1 Replies

8. Linux

How to open a gnome-terminal in specific workspace and run script within it automatically upon login

OK this is a bit messy. I run Fedora with gnome on a compiz desktop, I have a script (userstart) that opens my 'standard' environment for all my machines when I login. userstart flips to a specific workspace and then opens the required applications in that workspace then flips to the next... (2 Replies)
Discussion started by: Bashingaway
2 Replies

9. Shell Programming and Scripting

Open gnome-terminal with multi tabs and automatically run a script in each tab

Hi All , i am trying to create an alias to open a new gnome-terminal and run some commands in each tab & to have a specific name for each tab i am using csh , tried this command gnome-terminal --tab -t "s1" --tab -t "s2" --tab -t "s3" --tab -t "s4" it opened 4 tabs but the title didn't... (0 Replies)
Discussion started by: Assem
0 Replies

10. Shell Programming and Scripting

Run script in new terminal

Hi Guys, I have a script that runs certain simulations in batch mode. I need to schedule some simulations to run over night. For each simulation to complete it should be run in separate terminal. My script is as follows sh run_test.sh <arg1> <arg2> <arg3> ... I need to launch this... (5 Replies)
Discussion started by: aelhosiny
5 Replies
gnome-terminal(1)						   User Commands						 gnome-terminal(1)

NAME
gnome-terminal - terminal emulator for GNOME SYNOPSIS
gnome-terminal [--window-with-profile=profilename] [--tab-with-profile=profilename] [--command command] [--execute command] [--role=role] [--show-menubar | --hide-menubar] [--use-factory | --disable-factory] [--title=title] [--working-directory=dirname] [gnome-std-options] DESCRIPTION
gnome-terminal is the GNOME terminal emulation program. It provides access to the UNIX shell on the GNOME environment. gnome-terminal sup- ports multiple profiles to allow easy switching between preferences, and supports tabbing so that multiple terminals can be managed from a single window. By default, all GNOME terminals share a single process, reducing memory usage. This can be disabled by starting gnome-ter- minal with the --disable-factory option. OPTIONS
The following options are supported: --command commanExecutes the command command instead of the shell. This saves some memory if you just plan to run a dedicated application on that window. You can also use -e to specify this option. --execute commanThis option is provided for compatibility reasons. It is the same as the --command option. You can also use -x to specify this option. --disable-factorDo not register with the activation name server, and do not reuse an already running GNOME terminal process. --hide-menubar Hide the menubar. This applies only to one window. When used with multiple --window-with-profile options, it applies to the --window-with-profile option immediately to the left. Can be specified multiple times, once for each --window-with-profile option. --role=role The GNOME session manager follows the ICCCM convention of using the window title and the window role to identify specific windows. The session manager uses this information to put windows back in the same place when the user restarts their ses- sion. If all windows have a unique title, there is no need to set the role. However, as it is common for multiple GNOME terminals to have the same title, the user can also specify the role on the command line with the --role option. This helps the session manager to properly identify and restart each GNOME terminal (in the same location, and so on). When used with multiple --window-with-profile options, it applies to the --window-with-profile option immediately to the left. Can be specified multiple times, once for each --window-with-profile option. --show-menubar Show the menubar. This applies only to one window. When used with multiple --window-with-profile options, it applies to the --window-with-profile option immediately to the left. Can be specified multiple times, once for each --window-with-profile option. --tab-with-profiCreatesilanatab that uses the specified profile. This argument may be specified multiple times to create multiple tabs in a terminal. If this is used with multiple --window-with-profile options, the tab is created for the window that corresponds to the --window-with-profile option immediately to the left. --title=title Set the title for the GNOME terminal to be title. --use-factory Register with the activation name server, and reuse an already running GNOME terminal process. --window-with-prCreatesroaiGNOMEeterminal and a tab that uses the specified profile. This may be used with the --tab-with-profile option to create additional tabs. Multiple --window-with-profile options can be specified to create multiple GNOME terminal windows. All options specified after an --window-with-profile option apply to that --window-with-profile option only. --working-directSet=thenworking directory for the GNOME terminal to be dirname. gnome-std-optionStandard options available for use with most GNOME applications. See gnome-std-options(5) for more information. EXTENDED DESCRIPTION
gnome-terminal is designed to emulate the xterm program provided by the X Consortium. The xterm(1) program in turn is an almost-complete emulation of the DEC VT102 terminal. gnome-terminal supports the same extensions to the VT102 as those provided by the xterm program, through special escape sequences. The xterm program is an evolving program. Recent changes to xterm have been been incorporated into gnome- terminal. This includes emulation of the newer DEC VT220 escape sequences. EXAMPLES
Example 1: Running the `minicom' terminal emulator on the window example% gnome-terminal --command minicom Example 2: Monitoring the system example% gnome-terminal --command top Example 3: Starting two windows with different profiles example% gnome-terminal --window-with-profile=FirstProfile --tab-with-profile=SecondProfile --window-with-profile=SecondProfile In this example, the first window will have two tabs (FirstProfile and SecondProfile) and the second window will have one tab (SecondPro- file). ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables, set by gnome-terminal: TERM This variable is set to xterm by default. Some implementations of curses, and applications based on curses, may prefer the value to be xterm-color, color-xterm, or xterm-debian to support color. Users might need to change this setting to one of these values to enable color for such applications. COLORTERM This variable is set to xterm. Various applications (especially the Slang-based applications) use this setting to determine whether the terminal supports color. WINDOWID This variable contains the X11 Window identifier. This is sometimes used by applications to modify the contents of this window or provide special effects. EXIT STATUS
The following exit values are returned: 0 Application exited successfully >0 Application exited with failure FILES
The following files are used by this application: /usr/bin/gnome-terminal Executable for GNOME terminal emulator ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-terminal | +-----------------------------+-----------------------------+ |Interface stability |External | +-----------------------------+-----------------------------+ SEE ALSO
gnome-session(1), xterm(1), vte(1), libvte(3), gnome-std-options(5) Latest version of the GNOME Desktop User Guide for your platform. NOTES
Written by Michael Zucchi, Miguel de Icaza, Erik Troan. Updated by Brian Cameron, Sun Microsystems Inc., 2003, 2004. SunOS 5.10 31 Aug 2004 gnome-terminal(1)
All times are GMT -4. The time now is 12:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy