What is the difference between ${releasever} and $releasever?

Hi,

This WiKi page gives this command:

sudo sed -i 's/15.1/**${releasever}**/g' /etc/zypp/repos.d/*.repo

And this page says:

sed -i 's/15.1/**$releasever**/g' /etc/zypp/repos.d/*.repo

Do the curly braces make a difference? Does it matter?
And where is the environment variable $releserver? I can’t find it locally?

Regards,

It is all in

man zypper

If a variable is followed by an alphanumeric character or underscore it needs to be enclosed in {}:

So in most cases the {} are not needed because it is between / and / in the .repo files.

I can not find the word “environment” in that page. Where do you see it?

I am not aware such an environment variable (with or without the $) is involved here. Why do you think so?

I’m not sure what you are looking for there. The variable $releasever is internal to zypper.

From the “zypper” man page:

“Use this variable to refer to the version of your openSUSE or SUSE Linux. The value is obtained from the /product/version XML-node in /etc/products.d/baseproduct.”

and

This is how you can set a custom variable, e.g. $releasever to a value of 99.0:

echo "99.0" >/etc/zypp/vars.d/releasever

As I quoted from the man page, $releasever is the basic way to do this. But as there are more of those variables (see the man page), their must be a way to see where the parameter stops and other characters in the total string start again.

something/$releasever/somethingelse

is fine, but

something$releaseversomethingelse

is wrong because the variable releaseversomethingelse will not be defined.
It is the same in bash and the developers use the same method to avoid the problem (but from there the similarity stops).

something${releasever}somethingelse

is OK.

It is a bit technical and probably not very applicable in the case of $releasever, but the zypper developers came with a general solution for having parameters in the .repo definitions and it is explained in the man page!

Now the OP saw it somewhere mentioned and was confused about what to use. Thus his question.
You can of course always use the full form, but the one without the {} will work with all the $releasever in .repo definitions I saw thus far.

Thank you all for a very rapid and full explanation.

When (many years ago), I was in the military, I was taught never to press a button UNLESS I knew what it did!
Maintaining my PC forces me to go against this rule - I see lots of advice to “Do This…” “Click that…”
It seems to me that although the advice is well meant, very rarely am I at the same starting point that the author thinks I should be!

Regards,

PS - I (think) I have successfully upgraded to 15.2 :slight_smile:

Nowadays we have the “culture” of “I read it on the Interne!t”. Just stupidly do what you read somewhere and then complain to the world that your system (or whatever) is borked. rotfl!

You are correct. Read any advice/help and then try to understand waht the statements do. Read man pages, etc. Or ask here on the forums.

Nice. I did two systems last two weeks in the same way as you seem to have done. No problems here (except a few surprises from KDE, but that is only to be expected :().

Ah… That’s interesting? I know its not forum etiquette to mix threads topics. But…

Was your KDE problem anything like: “Dr Konqi - We are sorry, kdeinit5 closed unexpectedly. You cannot report <…> address
This is every time I open Dolphin.

Regards,

No I do not see that. Indeed better start a new thread for that.

What I mean is not real breaking things, but small changes in the UI. Other cursor forms, changes of defaults (one of the meanest things you can do to a user, change a default of something he never configured and thus used that default because it fits his needs). All those minor things that make you think: do you really need to pester me?