Re: Fwd: Re: interactive shell detection in shrc

Steffen Nurpmeso <[email protected]>
Newsgroups gmane.os.netbsd.devel.userlevel
Message-ID <20240925230349.JbN0CCwF@steffen%sdaoden.eu>
Robert Elz wrote in
 <[email protected]>:
 |    Date:        Tue, 24 Sep 2024 23:54:13 +0000 (UTC)
 |    From:        RVP <[email protected]>
 |    Message-ID:  <[email protected]>
 |
 || 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 <[email protected]>

--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)
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.