🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.bash.bug
Article #245

Re: rsh, rcp with bash

#245
From: Noah Friedman
Date: Thu, 30 Jul 1992 20:36
28 lines
1426 bytes
In article <2A7691FE.7354@tct.com> chip@tct.COM (Chip Salzenberg) writes:
>According to chet@po.cwru.edu:
>>Bash attempts to source the .bashrc for non-interactive shells running
>>rsh and rcp so things like $PATH get set.
>
>... which is, in my opinion, a BIG mistake.

   I don't think it's a mistake at all.  Not only do other shells do this
(so it's expected behavior), but it's really useful for getting things like
your PATH. 

   It's conventional wisdom that you put interactive commands in an `if'
that checks if PS1 is set.  I keep it them in a separate file, personally.

   Here's a trivial way of doing it:

        PATH=...
        # Other noninteractive commands here

        if [ -z "${PS1}" ]; then
           return 0
        fi

        # interactive commands here.        


Works in relatively recent versions of bash which stop sourcing files after
they see a top-level return. 
Technical Details
Message-ID: <FRIEDMAN.92Jul30163616@nutrimat.gnu.ai.mit.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!gnu.ai.mit.edu!friedman
References: <9207241236.AA02088.SM@odin.INS.CWRU.Edu>

Show Full Headers
Complete Article Headers
Newsgroups: gnu.bash.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!gnu.ai.mit.edu!friedman
From: friedman@gnu.ai.mit.edu (Noah Friedman)
Subject: Re: rsh, rcp with bash
Message-ID: <FRIEDMAN.92Jul30163616@nutrimat.gnu.ai.mit.edu>
Sender: gnulists@ai.mit.edu
Organization: Free Software Foundation, 675 Mass Ave. Cambridge, MA 02139
References: <9207241236.AA02088.SM@odin.INS.CWRU.Edu> 
Distribution: gnu
Date: Thu, 30 Jul 1992 20:36:16 GMT
Approved: bug-bash@prep.ai.mit.edu
Lines: 30