Using "*" to search/install a package with dnf

I’m using zsh as my shell and I’ve found that when I do dnf search python* I get zsh: no match found: python*, so I need to use dnf search python\*. But in bash I can use the package name plus “*” without a backslash, and this is a problem that only occurs in dnf, if I do ls P* or something similar with other commands in zsh, I get the normal output that I would expect without needing the backslash.

I don’t know if this is a problem with dnf or just how zsh works.

That is a difference between bash and zsh.
If you intend to continue using zsh then you need to learn the differences in the way the zsh shell works vs the bash shell and remember to always take the difference in account when using commands you find on this forum. Remember that the great majority of users use bash and the commands seen here are almost 100% bash shell compatible.

1 Like

Yes, I know bash and zsh are different, my question was more about why “*” seems to work in other programs, but in dnf I need to use “\*”.

So it was a question about how zsh handles this, as I haven’t found anything about it elsewhere. And since there is no zsh tag on this forum, I marked it with dnf, as it is the only command where I get this different result.

It’s controlled by zsh with the nomatch option. By default if a command line contains a globbing expression which doesn’t match anything it will print an error message.

In bash those globs are passed to the command if nothing matches.

In zsh they need to be quoted or escaped unless you modify the options.

If you search for zsh nomatch there are a few results, scp wildcard not working in zsh - Unix & Linux Stack Exchange

5 Likes