Re: executing a command in xterm and keep interactive

Olaf Dabrunz <[email protected]>
Newsgroups gmane.linux.suse.programming
Message-ID <[email protected]>
On 19-Jan-08, Hans-Peter Jansen wrote:
> Hi,
> 
> I'm trying to automate some processes, where an initial command should run 
> inside a xterm, and the xterm kept interactive thereafter (xterm -e ...). 
> 
> Since the culprit seem bash, I've tried most ways of invoking bash 
> with -i, -s and -c options, but as soon as I give bash the -c option, it 

The only possibility I see is to start an interactive shell and let it
read your initial command from a special rcfile:

    xterm -e bash --rcfile my_command

-- my_command: --------------------------------------------------
#!/bin/bash

# this mini-script is sourced instead of $HOME/.bashrc, so we source
# $HOME/.bashrc anyway, before or after "your command"
. $HOME/.bashrc

your command
-----------------------------------------------------------------

(Also, usually, in this case you do not need the -i option to bash.)

Otherwise, if you used the -c option to read commands from a string, you
can not change (redirect) the command source anymore, as it is not
through an open file but just the command line argument that is
interpreted by the shell. The shell will inevitably terminate after all
commands have been processed.

Regards,

-- 
Olaf Dabrunz (Olaf <at> dabrunz.com)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.