tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Fwd: Re: interactive shell detection in shrc



Robert Elz wrote in
 <6599.1727248627%jacaranda.noi.kre.to@localhost>:
 |    Date:        Tue, 24 Sep 2024 23:54:13 +0000 (UTC)
 |    From:        RVP <rvp%SDF.ORG@localhost>
 |    Message-ID:  <4d7cdca7-fcf4-8985-7c1d-79ef63125e00%SDF.ORG@localhost>
 |
 || On Tue, 24 Sep 2024, Steffen Nurpmeso wrote:
 |
 |I replied to Steffen's (pre-forwarded) message off list, but:
 |
 || Yes, this surprised me too. This test is true if $___SHRC is undefined,
 |
 |(or empty)
 |
 || No, that becomes `if ":" ...' $___SHRC is undefined or empty. You need to
 || write it that way, else it's a syntax error.
 |
 |Not a syntax error, an execution error, it would attempt to run the \
 |"" command
 |which cannot possibly exist in the filesystem, so results in "command \
 |not found".
 |
 |In NetBSD's sh you can actually do
 |
 | ''() { echo nothing; }
 |
 |(where the function body can be anything of course), then the empty-string
 |command (as distinct from absent command) does exist, and works, but \
 |I would
 |not recommend this to anyone, it isn't likely to work elsewhere.

Btw last night i had half an hour or so and fixed it all for
.profile and .shrc, the latter now does

  if [ -z "$___SHRC" ]; then
          ___SHRC=y
          case $- in
          *i*|*m*) ___shrc;;
          esac
  fi

 |kre
 --End of <6599.1727248627%jacaranda.noi.kre.to@localhost>

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)


Home | Main Index | Thread Index | Old Index