1

I am using macOS 10.15.6 with zsh.

I was creating a small script for bash and ksh, and wanted to test it quickly in zsh, and found that zsh was behaving strangely compared to other shells.

Here is the culprit line in my code (simplify to the extreme):

ls something.* 2> /dev/null

In the case that there are no file beginning with "something.", then you should get no output, no error, nothing. Just nothing. It just works with bash, ksh and sh.

So back to my problem, on macOS I have this version zsh 5.7.1 (x86_64-apple-darwin19.0)

the output I get when running the previous command is the following:

% ls something.* 2> /dev/null
zsh: no matches found: something.*

Is that normal? Why the stderr was not redirected to /dev/null???

This is one of the first time I am really using zsh, so I might have missed something here.

I have read the documentation at this link, and I don't see how this simple line is wrong according to the zsh documentation... ( http://zsh.sourceforge.net/Doc/Release/Redirection.html )

Thank you in advance for your help!

0 Answers0