LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 10-15-2004, 08:44 AM   #1
chunlee
Member
 
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:

#!/bin/sh
gnome-terminal
echo -n "a new terminal"

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

how would i solve this?

cheers

CHUN
 
Old 10-15-2004, 02:02 PM   #2
marcheikens
Member
 
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:

Code:
#!bin/sh

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?

marc
 
Old 10-15-2004, 02:33 PM   #3
chunlee
Member
 
Registered: Jun 2004
Location: london
Distribution: gentoo
Posts: 114

Original Poster
Rep: Reputation: 15
thanks!

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

cheers

CHUN
 
  


Reply


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 05:04 PM
print the terminal saosurya Red Hat 1 09-11-2005 11:54 PM
Sheel Script kjsubbu Linux - General 5 11-25-2004 08:14 PM
How to open programs in terminal without being stuck to the terminal?? brynjarh Linux - Newbie 6 07-07-2004 01:52 PM
Scripting question: the width of the terminal window Bebo Programming 13 11-06-2003 05:41 PM


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

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