[Rpm-maint] [rpm-software-management/rpm] How to expand user possibly non-existent user constructed variable name? (Discussion #3411)

Vít Ondruch notifications at github.com
Tue Oct 29 17:27:56 UTC 2024


I have this snippet:

~~~
$ rpm -D "name string-io" -D "string_io_prerelease .dev" --eval "%{expand:%{%{gsub %{name} - _}_prerelease}}"
.dev
~~~

But if the `name` does not match to the next definition, the non existing variable is printed out:

~~~
$ rpm -D "name foo" -D "string_io_prerelease .dev" --eval "%{expand:%{%{gsub %{name} - _}_prerelease}}"
%{foo_prerelease}
~~~

But I would like to just ignore such output, but this (the additional `?`) does not work (the output is always empty):

~~~
$ rpm -D "name foo" -D "string_io_prerelease .dev" --eval "%{expand:%{?%{gsub %{name} - _}_prerelease}}"

$ rpm -D "name string-io" -D "string_io_prerelease .dev" --eval "%{expand:%{?%{gsub %{name} - _}_prerelease}}"

~~~

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/discussions/3411
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/repo-discussions/3411 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20241029/2d1c500d/attachment-0001.html>


More information about the Rpm-maint mailing list