Re: `which` and infinite recursion
On Sat, Jun 22, 2002 at 10:54:15PM -0400, Joseph Barillari wrote:
> I investigated my .bashrc, and found that the offending line was
>
> export CVS_RSH=`which ssh`
>
> Because `which` is implemented as a bash script, invoking it causes
> .bashrc to be read, and `which ssh` to be evaluated, which causes
> `which` (a bash script) to be invoked, which causes .bashrc to be
> read, which causes `which ssh` to be evaluated, ad infinitum.
How about finding out whether your shell's interactive before running
which? This should do it:
case $- in
*i*)
export CVS_RSH=`which ssh`
... other similar stuff ...
;;
esac
Cheers,
--
Colin Watson [cjwatson@flatline.org.uk]
--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: