2

While attempting to remove all the Ubuntu MATE stuff that got onto my system, fish seemed to reject wildcards for apt-get.

sudo apt-get remove mate-*
fish: No matches for wildcard “mate-*”. See `help expand`.

I have to switch over to bash every time I want to mass remove/install packages. Is there any way to use wildcards in fish for apt-get?

1
  • When you tap TAB button in you keyboard after typped "...remove mate, what's happens? – Weyder Ferreira May 5 at 14:25
5

What you are doing here is ambiguous even in bash.

In bash, if the noglob option is not set and mate-* matches one or more files in the current directory, it will be expanded to a list of those files which will be passed as arguments to apt-get remove. Otherwise, it will be passed literally to the apt-get command unless:

  • the failglob option is set, in which case the behavior will be the same as in fish
  • the nullglob option is set, in which case mate-* will be removed altogether

In fish, the behavior appears to be equivalent to bash's failglob, and there does not seem to be an equivalent of bash's set -o noglob or set -f. So you will need to prevent globbing explicitly by quoting, ex.

sudo apt-get remove "mate-*"

or

sudo apt-get remove mate-"*"

(which you really should be doing in bash, for the reasons outlined above).

See also:

Also be aware that apt has moved away from simple wildcards altogether in favor of aptitude-style patterns - see Problem using wildcard with apt.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.