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, 10:46 AM
Carl Friis-Hansen
 
Default How to execute a command in newly open terminal(gnome-terminal) in scripting ?

Quoting amritpal pathak <amritpalpathak1@gmail.com>:


hey
I am making a script in which i am opening a new terminal using
"gnome-terminal" and at next line in scripting ,i have another command to
start some process.I need this command should be executed seprately in newly
open terminal but it is running in current terminal.
How i can do it .

Thanks in advance

amritpalpathakgne.wordpress.com



You might need to do it on the same line, like:
gnome-terminal -e "ls -l"

If you want really good control, you could make a small C or C++ program.

Regards
Carl Friis-Hansen



--
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, 08:40 AM
Donald Talbert
 
Default How to execute a command in newly open terminal(gnome-terminal) in scripting ?

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

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

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.

Regards,
-Don

--
Donald Talbert <donaldtalbert@gmail.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, 09:45 AM
Donald Talbert
 
Default How to execute a command in newly open terminal(gnome-terminal) in scripting ?

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.

Regards,
-Don

--
Donald Talbert <donaldtalbert@gmail.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:19 AM
Donald Talbert
 
Default How to execute a command in newly open terminal(gnome-terminal) in scripting ?

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.

--
Donald Talbert <donaldtalbert@gmail.com>


--
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 03:10 AM.

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