FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu User

 
 
LinkBack Thread Tools
 
Old 06-30-2011, 11:02 AM
amritpal pathak
 
Default How to execute a command in newly open terminal(gnome-terminal) in scripting ?

On Thu, Jun 30, 2011 at 6:54 AM, Jordon Bedwell <jordon@envygeeks.com> wrote:

On 6/30/2011 5:46 AM, Carl Friis-Hansen wrote:

> You might need to do it on the same line, like:

> gnome-terminal -e "ls -l"
*it couldn't help.It is executing the command in same terminal even it is not opening new one despite "gnome-termial" was opening a new terminal at least.


* Thanks *
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 07-01-2011, 09:05 AM
amritpal pathak
 
Default How to execute a command in newly open terminal(gnome-terminal) in scripting ?

On Fri, Jul 1, 2011 at 4:40 AM, Donald Talbert <donaldtalbert@gmail.com> wrote:

On Thu, 2011-06-30 at 07:02 -0400, amritpal pathak wrote:

>

>

> On Thu, Jun 30, 2011 at 6:54 AM, Jordon Bedwell <jordon@envygeeks.com>

> wrote:

> * * * * On 6/30/2011 5:46 AM, Carl Friis-Hansen wrote:

> * * * * > You might need to do it on the same line, like:

> * * * * > gnome-terminal -e "ls -l"

> * * * * *it couldn't help.It is executing the command in same terminal

> * * * * even it is not opening new one despite "gnome-termial" was

> * * * * opening a new terminal at least.

>

>

>

> * Thanks



I might be mistaken on what your trying to accomplish but heres a way to

do this. You will need to 'screen' package so type, then read the man

page on it, very easy to use.



sudo apt-get install screen

*done.

Heres how you do this. (A snip of code from our scripts)



screen -AdmS server /srv/serv/linux-start.sh



you would type...



screen -AdmS windowname directorytoscript-or-whatyouwanttorun
* windowname is for what? * * *is it user-choice to give a name what he wants?* * *windowname is name to new opened terminal?


screen is a very very useful program, be sure to read the man page. Its
*not hard to learn and will help you with bash shells.

** * *Thank you very much.* * * I am newbie to bash scripting.I tried your give code but it did not work.It again did not open a new terminal and even did not ran the last command.See the my code below.
*May be i am wrong somewhere.*This is a a.sh file.** * ***echo "what is your name"read becho "your name is $b "screen -AdmS try sudo wget http://www.kannel.org/download/1.4.3/gateway-1.4.3.tar.gz


amritpalpathakgne.wordpress.com*

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 07-01-2011, 10:13 AM
Amrit Pal Pathak
 
Default How to execute a command in newly open terminal(gnome-terminal) in scripting ?

On Fri, Jul 1, 2011 at 5:45 AM, Donald Talbert <donaldtalbert@gmail.com> wrote:

On Fri, 2011-07-01 at 05:05 -0400, amritpal pathak wrote:

>

>

> On Fri, Jul 1, 2011 at 4:40 AM, Donald Talbert

> <donaldtalbert@gmail.com> wrote:

>

> * * * * On Thu, 2011-06-30 at 07:02 -0400, amritpal pathak wrote:

> * * * * >

> * * * * >

> * * * * > On Thu, Jun 30, 2011 at 6:54 AM, Jordon Bedwell

> * * * * <jordon@envygeeks.com>

> * * * * > wrote:

> * * * * > * * * * On 6/30/2011 5:46 AM, Carl Friis-Hansen wrote:

> * * * * > * * * * > You might need to do it on the same line, like:

> * * * * > * * * * > gnome-terminal -e "ls -l"

> * * * * > * * * * *it couldn't help.It is executing the command in

> * * * * same terminal

> * * * * > * * * * even it is not opening new one despite

> * * * * "gnome-termial" was

> * * * * > * * * * opening a new terminal at least.

> * * * * >

> * * * * >

> * * * * >

> * * * * > * Thanks

>

>

> * * * * I might be mistaken on what your trying to accomplish but

> * * * * heres a way to

> * * * * do this. You will need to 'screen' package so type, then read

> * * * * the man

> * * * * page on it, very easy to use.

>

> * * * * sudo apt-get install screen

> * * * * *done.

> * * * * Heres how you do this. (A snip of code from our scripts)

>

> * * * * screen -AdmS server /srv/serv/linux-start.sh

>

> * * * * you would type...

>

> * * * * screen -AdmS windowname directorytoscript-or-whatyouwanttorun

> * * * * * windowname is for what?

> * * *is it user-choice to give a name what he wants?

> * * *windowname is name to new opened terminal?

>

>

> * * * * screen is a very very useful program, be sure to read the man

> * * * * page. Its

> * * * * *not hard to learn and will help you with bash shells.

>

> * * *Thank you very much.

> * * * I am newbie to bash scripting.I tried your give code but it did

> not work.It again did not open a new terminal and even did not ran the

> last command.See the my code below.

> *May be i am wrong somewhere.

> *This is a a.sh file.

>

> * echo "what is your name"

> read b

> echo "your name is $b "

> screen -AdmS try sudo wget

> http://www.kannel.org/download/1.4.3/gateway-1.4.3.tar.gz

>

>

>

>

> * * * * amritpalpathakgne.wordpress.com



It ran, type 'screen -ls' you should see a screen labeled "try".

With screen the 'd' flag means detach the screen so your script can

continue. So for a more desired effect maybe you could try removing the

d.



screen -AdmS try sudo wget

http://www.kannel.org/download/1.4.3/gateway-1.4.3.tar.gz



But I see what your trying to do now...



See if this does what you want it to... if it does feel free to remove

screen by typing 'sudo apt-get auto-remove screen'



gnome-terminal -e 'wget

http://www.kannel.org/download/1.4.3/gateway-1.4.3.tar.gz'



Let me know if this works for you.

*Rocks.......* * its is working.* * But i tried two commands first is running well in 1st newly open terminal but second is not.It is showing the 2nd new terminal is appear for a moment and then it disappair.
why?
*see the code please.*echo "what is your name"read becho "your name is $b "gnome-terminal -e 'wget http://www.kannel.org/download/1.4.3/gateway-1.4.3.tar.gz'
gnome-terminal -e 'sudo smsbox -v 1 kannel/kannel.conf'
Thanks you very much*
amritpalpathakgne.wordpress.com *

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 07-01-2011, 10:41 AM
Amrit Pal Pathak
 
Default How to execute a command in newly open terminal(gnome-terminal) in scripting ?

On Fri, Jul 1, 2011 at 6:19 AM, Donald Talbert <donaldtalbert@gmail.com> wrote:

On Fri, 2011-07-01 at 06:13 -0400, Amrit Pal Pathak wrote:

>

>

> On Fri, Jul 1, 2011 at 5:45 AM, Donald Talbert

> <donaldtalbert@gmail.com> wrote:

>

> � � � � On Fri, 2011-07-01 at 05:05 -0400, amritpal pathak wrote:

> � � � � >

> � � � � >

> � � � � > On Fri, Jul 1, 2011 at 4:40 AM, Donald Talbert

> � � � � > <donaldtalbert@gmail.com> wrote:

> � � � � >

> � � � � > � � � � On Thu, 2011-06-30 at 07:02 -0400, amritpal pathak

> � � � � wrote:

> � � � � > � � � � >

> � � � � > � � � � >

> � � � � > � � � � > On Thu, Jun 30, 2011 at 6:54 AM, Jordon Bedwell

> � � � � > � � � � <jordon@envygeeks.com>

> � � � � > � � � � > wrote:

> � � � � > � � � � > � � � � On 6/30/2011 5:46 AM, Carl Friis-Hansen

> � � � � wrote:

> � � � � > � � � � > � � � � > You might need to do it on the same

> � � � � line, like:

> � � � � > � � � � > � � � � > gnome-terminal -e "ls -l"

> � � � � > � � � � > � � � � �it couldn't help.It is executing the

> � � � � command in

> � � � � > � � � � same terminal

> � � � � > � � � � > � � � � even it is not opening new one despite

> � � � � > � � � � "gnome-termial" was

> � � � � > � � � � > � � � � opening a new terminal at least.

> � � � � > � � � � >

> � � � � > � � � � >

> � � � � > � � � � >

> � � � � > � � � � > � Thanks

> � � � � >

> � � � � >

> � � � � > � � � � I might be mistaken on what your trying to

> � � � � accomplish but

> � � � � > � � � � heres a way to

> � � � � > � � � � do this. You will need to 'screen' package so type,

> � � � � then read

> � � � � > � � � � the man

> � � � � > � � � � page on it, very easy to use.

> � � � � >

> � � � � > � � � � sudo apt-get install screen

> � � � � > � � � � �done.

> � � � � > � � � � Heres how you do this. (A snip of code from our

> � � � � scripts)

> � � � � >

> � � � � > � � � � screen -AdmS server /srv/serv/linux-start.sh

> � � � � >

> � � � � > � � � � you would type...

> � � � � >

> � � � � > � � � � screen -AdmS windowname

> � � � � directorytoscript-or-whatyouwanttorun

> � � � � > � � � � � windowname is for what?

> � � � � > � � �is it user-choice to give a name what he wants?

> � � � � > � � �windowname is name to new opened terminal?

> � � � � >

> � � � � >

> � � � � > � � � � screen is a very very useful program, be sure to

> � � � � read the man

> � � � � > � � � � page. Its

> � � � � > � � � � �not hard to learn and will help you with bash

> � � � � shells.

> � � � � >

> � � � � > � � �Thank you very much.

> � � � � > � � � I am newbie to bash scripting.I tried your give code

> � � � � but it did

> � � � � > not work.It again did not open a new terminal and even did

> � � � � not ran the

> � � � � > last command.See the my code below.

> � � � � > �May be i am wrong somewhere.

> � � � � > �This is a a.sh file.

> � � � � >

> � � � � > � echo "what is your name"

> � � � � > read b

> � � � � > echo "your name is $b "

> � � � � > screen -AdmS try sudo wget

> � � � � > http://www.kannel.org/download/1.4.3/gateway-1.4.3.tar.gz

> � � � � >

> � � � � >

> � � � � >

> � � � � >

> � � � � > � � � � amritpalpathakgne.wordpress.com

>

>

> � � � � It ran, type 'screen -ls' you should see a screen labeled

> � � � � "try".

> � � � � With screen the 'd' flag means detach the screen so your

> � � � � script can

> � � � � continue. So for a more desired effect maybe you could try

> � � � � removing the

> � � � � d.

>

> � � � � screen -AdmS try sudo wget

> � � � � http://www.kannel.org/download/1.4.3/gateway-1.4.3.tar.gz

>

>

> � � � � But I see what your trying to do now...

>

> � � � � See if this does what you want it to... if it does feel free

> � � � � to remove

> � � � � screen by typing 'sudo apt-get auto-remove screen'

>

> � � � � gnome-terminal -e 'wget

> � � � � http://www.kannel.org/download/1.4.3/gateway-1.4.3.tar.gz'

>

> � � � � Let me know if this works for you.

> � � � � �Rocks.......

> � � its is working.

> � � But i tried two commands first is running well in 1st newly open

> terminal but second is not.It is showing the 2nd new terminal is

> appear for a moment and then it disappair.

> why?

>

>

> �see the code please.

>

> echo "what is your name"

> read b

> echo "your name is $b "

> gnome-terminal -e 'wget

> http://www.kannel.org/download/1.4.3/gateway-1.4.3.tar.gz'

> gnome-terminal -e 'sudo smsbox -v 1 kannel/kannel.conf'

>

>

> Thanks you very much

>

>

> amritpalpathakgne.wordpress.com



Anytime buddy.



But i tried two commands first is running well in 1st newly open terminal but second is not.It is showing the 2nd new terminal is appear for a moment and then it disappair.why?
�see the code please.
�echo "what is your name"read becho "your name is $b "
gnome-terminal -e 'wget�http://www.kannel.org/download/1.4.3/gateway-1.4.3.tar.gz'
gnome-terminal -e 'sudo smsbox -v 1 kannel/kannel.conf'
Thanks you very much�

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 07-01-2011, 01:37 PM
Amrit Pal Pathak
 
Default How to execute a command in newly open terminal(gnome-terminal) in scripting ?

Anytime buddy.


* * Sir can i open number of terminals in this way and execute * ** *different commands in different terminals ?
* * Waiting your wise reply*

* *Thank you very much for support !!
* *amritpalpathakgne.wordpress.com *
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 07-01-2011, 02:16 PM
Koh Choon Lin
 
Default How to execute a command in newly open terminal(gnome-terminal) in scripting ?

> Sir can i open number of terminals in this way and execute
> different commands in different terminals ?
>
> Waiting your wise reply
>
> Thank you very much for support !!

Hi
You can open multiple instance of the terminal with different input of command. There are also tabs available.



Regards
Koh Choon Lin

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 07-01-2011, 02:23 PM
Amrit Pal Pathak
 
Default How to execute a command in newly open terminal(gnome-terminal) in scripting ?

On Fri, Jul 1, 2011 at 10:16 AM, Koh Choon Lin <kchoonlin@hotmail.com> wrote:





> Sir can i open number of terminals in this way and execute

> different commands in different terminals ?

>

> Waiting your wise reply

>

> Thank you very much for support !!



Hi

You can open multiple instance of the terminal with different input of command. There are also tabs available.



but how to do it.As guided by Donald i could do just open one terminal and when i tried to open 2 and execute different commands in it , it didn't work.
* *See following code.


echo "what is your name"read becho "your name is $b "gnome-terminal -e 'wget http://www.kannel.org/download/1.4.3/gateway-1.4.3.tar.gz'
gnome-terminal -e 'sudo smsbox -v 1 kannel/kannel.conf'

Thanks*
amritpalpathakgne.wordpress.com *

--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 07-04-2011, 06:49 AM
Amrit Pal Pathak
 
Default How to execute a command in newly open terminal(gnome-terminal) in scripting ?

On Fri, Jul 1, 2011 at 10:23 AM, Amrit Pal Pathak <amritpalpathak1@gmail.com> wrote:



On Fri, Jul 1, 2011 at 10:16 AM, Koh Choon Lin <kchoonlin@hotmail.com> wrote:






> Sir can i open number of terminals in this way and execute

> different commands in different terminals ?

>

> Waiting your wise reply

>

> Thank you very much for support !!



Hi

You can open multiple instance of the terminal with different input of command. There are also tabs available.



but how to do it.As guided by Donald i could do just open one terminal and when i tried to open 2 and execute different commands in it , it didn't work.
* *See following code.


Can anybody help me.?echo "what is your name"read becho "your name is $b "gnome-terminal -e 'wget http://www.kannel.org/download/1.4.3/gateway-1.4.3.tar.gz'

gnome-terminal -e 'sudo smsbox -v 1 kannel/kannel.conf'
* *Please take a look on above code and give me your wisdom help.
* *Thanks*

* amritpalpathakgne.wordpress.com**
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 07-13-2011, 05:38 PM
Amrit Pal Pathak
 
Default How to execute a command in newly open terminal(gnome-terminal) in scripting ?

Hey** * * * * * * * I *need a 3 commands to run into 3 terminals seprately so i did as follow in bash script
*echo "what is your name"read becho "your name is $b "
gnome-terminal -e 'bearerbox -v 1 kannel/kannel.conf'gnome-terminal -e 'wget http://www.kannel.org/download/1.4.3/gateway-1.4.3.tar.gz'
gnome-terminal -e ' smsbox -v 1 kannel/kannel.conf'
It is opening the 3 terminals but only 2nd command is running others 2(1st and 3rd) are not.*Why?

Thanks in advance*amritpalpathak.blogspot.com
--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 
Old 07-13-2011, 11:45 PM
Paul Sladen
 
Default How to execute a command in newly open terminal(gnome-terminal) in scripting ?

On Wed, 13 Jul 2011, Amrit Pal Pathak wrote:
> It is opening the 3 terminals but only 2nd command is running others 2(1st
> and 3rd) are not.

Put an ampersand ('&') at the end of the line to run the comamnd in
the background.

> Why?

When you do:

command1 ; command2 ; command3

this runs the commands in series (one after the other, each waiting
for the previous, whereas:

command1 & command2 & command3 &

will put all of them into the background, running them in parallel and
allowing you to continue with additional actions.

This 'multi-tasking' is one of the primary advantages that Unix had
have other operating system designs when it was designed.

> I need 3 commands to run into 3 terminals seprately

I actually do something quite similiar, but I use a 'screen' session
(see GNU Screen) with a '~/.screenrc' that starts IRC in one window,
text-based Email in another terminals in another. Before the
existance of multi-server IRC clients, it actually started several IRC
clients in parallel screens, each talking to a different server.
That bit is still there in the config file, commented out:

#screen -t "#jxxxxx" 3 epic4 -n sladen -c #jump irc.jxxxxx.org.uk
#screen -t "#qxxxxx" 4 epic4 -n sladen -c #quaker mxxxxxx.xxxx.xxxx
#screen -t "#uxxxxx" 5 epic4 -n sladen -c #uxxxxx ircnet.easynet.co.uk

This allows having just one 'gnome-terminal' open, but with multiple
tasks within it and being able to 'alt-tab' between them using Ctrl-a.

Hope that's useful!

-Paul


--
ubuntu-users mailing list
ubuntu-users@lists.ubuntu.com
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
 

Thread Tools




All times are GMT. The time now is 01:21 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org