More basic apt invocation

$ sudo apt list protonmail-bridge*
Listing... Error!
E: input:0-35: error: Expected pattern
   protonmail-bridge_2.1.1-1_amd64.deb
   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

What am I missing: ‘protonmail-bridge*’ is a pattern, isn’t it?

Try without the asterisk.

1 Like

This looks like the * was expanded by your shell before calling apt because you have a file called protonmail-bridge_2.1.1-1_amd64.deb in the current folder where you ran this command.

You can avoid this by putting the pattern within quotation marks:

sudo apt list "protonmail-bridge*"
3 Likes


It is just useless info that I’ve reproduced (within this particular .deb file folder) before installing that downloaded package (with: wget -c https://protonmail.com/download/bridge/protonmail-bridge_2.1.1-1_amd64.deb). Perhaps this helps:
sudo dpkg -i protonmail-bridge_2.1.1-1_amd64.deb
apt list protonmail-bridge
Listing… Done
protonmail-bridge/now 2.1.1-1 amd64 [installed,local]

You could try what @m4lvin suggested, or you could do it this way instead:

apt list | grep protonmail-bridge

The above means that you let “apt list” list everything and then pipe that result to grep to pick out lines that you are interested in.

2 Likes

In particular apt list pattern will only support glob patterns so if you need more advanced regular expressions then piping through grep is the way to go (and probably the more Unixy approach).

If you want to use the former approach then you can backslash-quote rather than enclosing in single or double quotes i.e. apt list protonmail-bridge\*

1 Like

Not to detract from the other suggestions, but I think @m4lvin hit on the problem.

I have the bridge installed. If I run ‘apt’ without the file (no quotes or anything), I get:

 sudo apt list protonmail-bridge*
 Listing... Done
 protonmail-bridge/now 2.1.1-1 amd64 [installed,local]

With the file in the directory:

 sudo apt list protonmail-bridge*
 Listing... Error!
 E: input:0-35: error: Expected pattern
    protonmail-bridge_2.1.1-1_amd64.deb

This looks like your problem exactly.

2 Likes

Thanks all for the input folks:
@Wayne was right, @m4lvin nailed it; @Skalman was also right, but takes (a little bit) longer.

$ sudo apt list "protonmail-bridge*"
Listing... Done
protonmail-bridge/now 2.1.1-1 amd64 [installed,local]

;

$ sudo apt list | grep protonmail-bridge

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

protonmail-bridge/now 2.1.1-1 amd64 [installed,local]

Thx

1 Like

This is normal, longstanding and not-always-desired shell glob behaviour.

If no files match the glob pattern then the shell leaves the word unchanged.( * )

You can easily test this with e.g.

echo proton*

If there is no file in the current directory whose name starts with proton then it will echo literally proton* while if there are one or more files in the current directory whose name starts with proton then it will list those file names.

* You can use the nullglob shell option to control this behaviour (when the glob pattern is not matched). When nullglob is on, the shell instead removes the word. So the above echo command would output a blank line.

You can use the failglob shell option to control this behaviour. When failglob is on, the shell instead treats it as an error. So the above echo command would just produce an error. This is actually what a newb user probably wants (as there is more chance that a user’s unintended globbing i.e. unquoted globbing, is brought to the user’s attention).

With the shell default behaviour (as applied to the original command), you have a command that works 99% of the time but then suddenly one day when the user is in the wrong working directory the command misbehaves - either gives an error or, worse still, works but does not do what is intended.

USER/Download# echo proton*
protonmail-bridge_2.1.1-1_amd64.deb
USER/Download# apt list protonmail-bridge\*
Listing… Done
protonmail-bridge/now 2.1.1-1 amd64 [installed,local]
USER/Download# apt list 'protonmail-bridge*'
Listing… Done
protonmail-bridge/now 2.1.1-1 amd64 [installed,local]
USER/Download# apt list protonmail-bridge
Listing… Done
protonmail-bridge/now 2.1.1-1 amd64 [installed,local
USER/Download# dpkg -l | grep protonmail-bridge | awk '{print $2}' | xargs -n1 echo
protonmail-bridge
USER/Download# apt list protonmail-bridge*
Listing… Error!
E: input:0-35: error: Expected pattern
protonmail-bridge_2.1.1-1_amd64.deb
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
USER/Download# cd ..
USER# apt list protonmail-bridge*
Listing… Done
protonmail-bridge/now 2.1.1-1 amd64 [installed,local]
USER# apt list protonmail-bridge libqt5gui5 libqt5core5a libgl1 libc6 libqt5widgets5 libqt5qml5 libqt5network5 libqt5svg5 libsecret-1-0 libglib2.0-0 libstdc++6 libgcc1 libpulse-mainloop-glib0 fonts-dejavu −− Suggested: pass gnome-keyring :thinking: