How to execute a command in newly open terminal(gnome-terminal) in scripting ?

amritpal pathak amritpalpathak1 at gmail.com
Fri Jul 1 09:05:53 UTC 2011


On Fri, Jul 1, 2011 at 4:40 AM, Donald Talbert <donaldtalbert at 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 at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20110701/b273b401/attachment.html>


More information about the ubuntu-users mailing list