1

Can somebody tell me why my command language interpreter shell shows me an empty string as the result after the command

$ echo $VERSION

And only after executing this command

$ . /etc/os-release

it begins to show me the result of that command

$ echo $VERSION

18.04.3 LTS (Bionic Beaver)

can you, please, explain me what happens after that command? Why had not shell shown it before? Why does shell show it now?

4

Running ". /etc/os-release" will run all lines in file "/etc/os-release" in your current shell; It seems that the file you are sourcing has a line like below that will set environment variable "VERSION" in your session:

VERSION="18.04.3 LTS (Bionic Beaver)"

If you are using bash then "source" will give you the same result: "source /etc/os-release"

You can check these in detail: https://ss64.com/bash/source.html or https://superuser.com/questions/46139/what-does-source-do

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.