shell programming challenge

Giorgos Keramidas keramida at ceid.upatras.gr
Fri Nov 26 03:57:42 PST 2004


On 2004-11-25 17:30, "Conrad J. Sabatier" <conrads at cox.net> wrote:
>
> OK, I think I've found what you're looking for:
>
> xterm -e "/usr/local/bin/bash --rcfile bash_commands -i"
>
> Substitute your program's startup script for "bash_commands" in the
> above.  Using the "-i" switch to bash forces interactive mode, so when
> the script exits, you'll be returned to the shell prompt in the xterm.
> As it turns out, xterm's "-hold" switch is wholly unnecessary here.
>
> Note that the "--rcfile" switch, being a "double-hyphened" option, must
> precede the later "-i" switch in order to be recognized.

Cool trick!

I was thinking something like adding the following to the local .bashrc:

	[-- .bashrc --]

	if [ ! X"${BASHRC_LOCAL}" = X"" ] && \
	   [ -r "${BASHRC_LOCAL}" ]; then
		. "${BASHRC_LOCAL}"
	fi

Then running xterm with BASHRC_LOCAL set to the path of the local bash
script:

	BASHRC_LOCAL="/path/foo" xterm -e bash

--rcfile is better though :-)



More information about the freebsd-questions mailing list