You are not logged in.

#1 2016-05-14 11:26:31

Soukyuu
Member
Registered: 2014-04-08
Posts: 854

[Solved]pacman: any search string starting with '-' parses as cmd[...]

Something like

pacman -Qs "-ck"
pacman -Qs '-ck'

is always resulting in

error: invalid option: '--search' and '--changelog' may not be used together

IMHO, pacman should not parse the string as a command argument when the string is quoted, but use the whole thing as a search string.

Last edited by Soukyuu (2016-05-14 13:08:10)


[ Arch x86_64 | linux | Framework 13 | AMD Ryzen™ 5 7640U | 32GB RAM | KDE Plasma Wayland ]

Offline

#2 2016-05-14 11:28:59

arojas
Developer
From: Spain
Registered: 2011-10-09
Posts: 2,093

Re: [Solved]pacman: any search string starting with '-' parses as cmd[...]

Use

pacman -Qs '\-ck'

Offline

#3 2016-05-14 11:35:50

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,788
Website

Re: [Solved]pacman: any search string starting with '-' parses as cmd[...]

You can also use -- to signify that what follows shouldn't be treated as an option. e.g.

$ pacman -Sqs -libgl
error: invalid option: '--info' and '--list' may not be used together

$ pacman -Sqs -- -libgl
mesa-libgl
nvidia-304xx-libgl
nvidia-340xx-libgl
nvidia-libgl
bumblebee
lib32-libglade
lib32-libglvnd
lib32-mesa
lib32-mesa-libgl
lib32-nvidia-304xx-libgl
lib32-nvidia-340xx-libgl
lib32-nvidia-libgl

Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#4 2016-05-14 11:44:18

Soukyuu
Member
Registered: 2014-04-08
Posts: 854

Re: [Solved]pacman: any search string starting with '-' parses as cmd[...]

Thanks, it's a bit counter-intuitive IMHO, but that works.

arojas wrote:

Use

pacman -Qs '\-ck'

-_-;;

I almost had it, then

pacman -Qs \-ck

[ Arch x86_64 | linux | Framework 13 | AMD Ryzen™ 5 7640U | 32GB RAM | KDE Plasma Wayland ]

Offline

#5 2016-05-14 11:47:14

Raynman
Member
Registered: 2011-10-22
Posts: 1,539

Re: [Solved]pacman: any search string starting with '-' parses as cmd[...]

Your shell interprets the quotes and they don't change anything in your examples -- pacman just sees -ck without the quotes. If you want to pass the quotes to pacman, you need to escape them, but pacman doesn't seem to handle that. The backslash also needs to be quoted for the shell (as in arojas example) or escaped:

pacman -Qs \\-ck

Offline

#6 2016-05-14 12:02:30

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,365
Website

Re: [Solved]pacman: any search string starting with '-' parses as cmd[...]

Using "--" is the standard way - it works for many commands.

Offline

#7 2016-05-14 13:06:20

Soukyuu
Member
Registered: 2014-04-08
Posts: 854

Re: [Solved]pacman: any search string starting with '-' parses as cmd[...]

I haven't seen that way being used, but I don't usually have to pass stuff starting with a dash. If you say it's a standard way to do it, then I just learned something new.

@Raynman: yes, it makes sense now.


[ Arch x86_64 | linux | Framework 13 | AMD Ryzen™ 5 7640U | 32GB RAM | KDE Plasma Wayland ]

Offline

Board footer

Powered by FluxBB