You are not logged in.

#1 2021-10-26 08:20:52

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 2,567
Website

[SOLVED] Peculiarity when matching package versions in bash

I just stumbled over this:

$ pacman -Q application-html<=1.83.0-1
application-html 1.83.0-1
$ pacman -Q application-html<=1.82.0-1
-bash: =1.82.0-1: Datei oder Verzeichnis nicht gefunden
$ 

The second error message by bash translates to "File or folder not found".

While I understand that this occurs, because bash tries to interpret the "<" as a file redirection, I wonder why this is not an issue in the first command.
All I changed is the number "3" to "2". Can somebody explain to me what's going on here?
I know that I can correctly query for versions by quoting the search string:

$ LANG=C pacman -Q "application-html<=1.82.0-1"
error: package 'application-html<=1.82.0-1' was not found

But still, it seems weird, that changing just a number results in a completely different interpretation by the shell.

Solution
What a facepalm-moment again. smile
Before the above command, I checked for a version "greater or equal", which of course resulted in the creation of a file due to the output redirect:

$ pacman -Q application-html>=1.83.0-1
$ ls
'=1.83.0-1'

I need a tea.

Last edited by schard (2021-10-26 08:27:18)


Inofficial first vice president of the Rust Evangelism Strike Force

Offline

Board footer

Powered by FluxBB