xterm &, run a setup script, xterm won't stay on

xterm &, run a setup script, xterm won't stay on

Post by wenman » Fri, 27 Jan 2006 00:05:42



Hi, all:
I am trying to run following command to generate a new xterm and
initialize env through a setup script. But the xterm exits after
executing the setup script and it doesn't stay on, how can I accomplish
this?
 xterm -T $hostname -e "${SHELL:-/bin/ksh}" -c ". $HOME/initEnv.sh" &
Thanks.
WM
 
 
 

xterm &, run a setup script, xterm won't stay on

Post by Benjamin Schiede » Fri, 27 Jan 2006 01:15:25



> Hi, all:
> I am trying to run following command to generate a new xterm and
> initialize env through a setup script. But the xterm exits after
> executing the setup script and it doesn't stay on, how can I accomplish
> this?
>  xterm -T $hostname -e "${SHELL:-/bin/ksh}" -c ". $HOME/initEnv.sh" &

You could add
exec ${SHELL:-/bin/ksh}
at the end of the script. Otherwise the script terminates and thus the xterm closes.

Greetings,
        Benjamin

--
Go away, or I will replace you with a very small shellscript!
        http://shellscripts.org/

 
 
 

xterm &, run a setup script, xterm won't stay on

Post by Jeremiah DeWitt Weine » Fri, 27 Jan 2006 01:25:10



> I am trying to run following command to generate a new xterm and
> initialize env through a setup script. But the xterm exits after
> executing the setup script and it doesn't stay on, how can I accomplish
> this?

        Does your xterm have the -hold option?  That will cause the xterm to
stay open until you manually close it.

Quote:>  xterm -T $hostname -e "${SHELL:-/bin/ksh}" -c ". $HOME/initEnv.sh" &

        Or, you could just do something like
... $HOME/initEnv.sh ; read DUMMY" &
which will cause the shell to wait for you to hit enter.

--
Oh to have a lodge in some vast wilderness.  Where rumors of oppression
and deceit, of unsuccessful and successful wars may never reach me
anymore.  
        -- William Cowper

 
 
 

xterm &, run a setup script, xterm won't stay on

Post by wenman » Fri, 27 Jan 2006 06:58:15


This is not what I want. What I want is to have env setup by the script
and env settings take affect on the xterm after execution. But it seems
not the case.
wm
 
 
 

xterm &, run a setup script, xterm won't stay on

Post by Kenny McCorma » Fri, 27 Jan 2006 07:39:55




>This is not what I want. What I want is to have env setup by the script
>and env settings take affect on the xterm after execution. But it seems
>not the case.
>wm

They do take effect in the xterm.  However, the xterm dies shortly
thereafter, so I don't see the point of having made the settings.
 
 
 

xterm &, run a setup script, xterm won't stay on

Post by Chris F.A. Johnso » Fri, 27 Jan 2006 07:59:27



> Hi, all:
> I am trying to run following command to generate a new xterm and
> initialize env through a setup script. But the xterm exits after
> executing the setup script and it doesn't stay on, how can I accomplish
> this?
>  xterm -T $hostname -e "${SHELL:-/bin/ksh}" -c ". $HOME/initEnv.sh" &

    You are telling xterm to exit after it finishes $HOME/initEnv.sh;
    that's what the -c option (to the shell) is for.

    If you are going to be executing a ksh, this will work:

ENV=$HOME/initEnv.sh xterm -T "$hostname" -e "${SHELL:-/bin/ksh}"

    Normally, you would put your initialization in the standard file
    that your shell uses (e.g. $HOME/.profile).

--
   Chris F.A. Johnson, author   |    <http://cfaj.freeshell.org>
   Shell Scripting Recipes:     |  My code in this post, if any,
   A Problem-Solution Approach  |          is released under the
   2005, Apress                 |     GNU General Public Licence

 
 
 

xterm &, run a setup script, xterm won't stay on

Post by Jeremiah DeWitt Weine » Sat, 28 Jan 2006 04:27:51



> This is not what I want.

        What is not what you want?  Please quote context when replying.

Quote:> What I want is to have env setup by the script
> and env settings take affect on the xterm after execution. But it seems
> not the case.

        Then you should have said so to begin with.  What you want is the
settings to take effect on the _shell_, not the xterm.  The xterm just
happens to be running the shell.  You told the xterm to run a single
command (and then exit), and the shell to run a single command (and then
exit), and that's just what they're doing.  If you want a script to
modify the shell's environment, you should be looking at your shell's
initialization files.

--
Oh to have a lodge in some vast wilderness.  Where rumors of oppression
and deceit, of unsuccessful and successful wars may never reach me
anymore.  
        -- William Cowper

 
 
 

1. can you open an xterm & run a subroutine in that xterm?

I'm using one script to open an xterm, which calls another script, is
there a better way to do this? Can you run a subroutine within the same
script?

#! /bin/sh

/usr/openwin/bin/xterm -e /tmp/run_me

*******run_me*****
while true
echo ""
echo "blah blah"
ls -l /h/data/local/db | wc -l
sleep 60
done

--
Posted via CNET Help.com
http://www.help.com/

2. Need Help with glib-1.2.8 install

3. ssh connections refused, sshd problem

4. xterm won't run with 2.4

5. Serial I/O programming question.

6. Getting FSB of the motherboard

7. rlogin won't run from XDM-launched xterms

8. Solution to: xterms won't run.

9. xterm, run a process, keep xterm open

10. xterm: how to open a new xterm and run telnet

11. I need an xterm Guru! xterm stopped running.