|
Home > Archive > Unix Shell > January 2006 > xterm &, run a setup script, xterm won't stay on
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
xterm &, run a setup script, xterm won't stay on
|
|
| wenmang 2006-01-29, 9:30 pm |
| 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
| |
| Benjamin Schieder 2006-01-29, 9:30 pm |
| wenmang wrote:
> 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/
| |
| Jeremiah DeWitt Weiner 2006-01-29, 9:30 pm |
| wenmang <wenmang@yahoo.com> wrote:
> 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.
> 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
| |
| wenmang 2006-01-29, 9:31 pm |
| 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
| |
| Kenny McCormack 2006-01-29, 9:31 pm |
| In article <1138226294.986618.123130@z14g2000cwz.googlegroups.com>,
wenmang <wenmang@yahoo.com> wrote:
>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.
| |
| Chris F.A. Johnson 2006-01-29, 9:31 pm |
| On 2006-01-25, wenmang wrote:
> 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
| |
| Jeremiah DeWitt Weiner 2006-01-29, 9:31 pm |
| wenmang <wenmang@yahoo.com> wrote:
> This is not what I want.
What is not what you want? Please quote context when replying.
> 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
|
|
|
|
|