On Wed, 25 Sep 2024, Robert Elz wrote:

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.


This is _very_ surprising; esp. when /bin/sh doesn't allow chars. like `/' and
`.' in the function name.

Can't see a use for this--except to suppress an error message in one inst.:

```
$ ''() false
[...]
$ unset foo
$ if "$foo"; then echo set; else echo unset; fi
```

or, to create (mildly) obfuscated fork-bombs:

```
''(){ ''|''&};''
```

-RVP

Reply via email to