Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 10-15-2004, 07:44 AM   #1
Registered: Jun 2004
Location: london
Distribution: gentoo
Posts: 114

Rep: Reputation: 15
sheel scripting (open new terminal and print in it)

hi there:

have just started learning shell scripting and run into this question i wonder if anyone could help.

i would like to use the script to open a new terminal and do stuff(ie, echo) in the new terminal window, i tried:

echo -n "a new terminal"

but this opens a new terminal but printed in the old terminal.

how would i solve this?


Old 10-15-2004, 01:02 PM   #2
Registered: Aug 2003
Location: Cleveland, OH
Distribution: Ubuntu 6.06
Posts: 66

Rep: Reputation: 15
You have to specify that you want the terminal that you initiate to perform your actions:


xterm -e "echo -n a new terminal && /bin/sh"
Would start a new xterm window, say "a new terminal," and then not exit but start the shell. the -e option tells it to run the following set of code. If you don't put the "&& /bin/sh" at the end of the code, the window will close. You could also use the -hold option to keep the window open, but without the directive to start a shell it'll be a useless window.

Regardless, the -e option has to be the very end of the command.

Hope this helps some. Btw I don't know why you use the -n option--all that does is not start a new line after echoing "a new terminal" doesn't it?

Old 10-15-2004, 01:33 PM   #3
Registered: Jun 2004
Location: london
Distribution: gentoo
Posts: 114

Original Poster
Rep: Reputation: 15

yes, that helped. as to the -n in echo, that explains why i am not getting a new line




Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How do i print a terminal screen? glenn69 Linux - Newbie 2 02-26-2012 04:04 PM
print the terminal saosurya Red Hat 1 09-11-2005 10:54 PM
Sheel Script kjsubbu Linux - General 5 11-25-2004 07:14 PM
How to open programs in terminal without being stuck to the terminal?? brynjarh Linux - Newbie 6 07-07-2004 12:52 PM
Scripting question: the width of the terminal window Bebo Programming 13 11-06-2003 04:41 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:59 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration