Thursday, February 22, 2024
 Popular · Latest · Hot · Upcoming
rated 0 times [  24] [ 0]  / answers: 1 / hits: 12365  / 2 Years ago, mon, january 3, 2022, 2:31:17


sudo apt-get remove --purge ubuntuone-* 
ERROR: zsh: no matches found: ubuntuone-*

Works on Bash. What's the problem ? :-D

More From » apt


Yes, zsh and bash behave differently in this regard.

In zsh, when you say "ubuntuone-*" it looks in your current working directory for files that start with ubuntuone- - since it does not find any, it says "no matches" and does not run the command.

bash takes a different tack - it also looks for files that start with ubuntuone- in the current working directory, but if it does not find any it says to itself, "Maybe the program I am invoking knows how to handle the wildcard," and so passes "ubuntuone-*" off to sudo apt-get as a literal argument.

If you had a file in your current working directory called ubuntuone-ffdjhjer, then bash would try to execute sudo apt-get remove --purge ubuntuone-ffdjhjer, which would probably fail.

In zsh (and in bash) you can use single quotes to tell it not to expand the wildcard but to pass it on, as in:

sudo apt-get remove --purge 'ubuntuone-*'

[#29859] Tuesday, January 4, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 490
Total Questions: 121
Total Answers: 108

Location: Nepal
Member since Mon, Jan 4, 2021
3 Years ago