Re: Fwd: Re: interactive shell detection in shrc

Robert Elz <[email protected]>
Newsgroups gmane.os.netbsd.devel.userlevel
Message-ID <[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.

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