Tag: shell variables

  • Linux Tutorial Series – 86 – Shell variables

    Here is the video version, if you prefer it:

    Let’s talk about shell variables today. Shell variables are temporary variables specific to the shell you are currently running. (Ward, 2014)⁠ Think of it like this – shell variables are temporary, environment variables are permanent.

    Here is an example of setting and printing out the contents of a shell variable:

    mislav@mislavovo-racunalo:~$ VARIABLE=stuff

    mislav@mislavovo-racunalo:~$ echo $VARIABLE

    stuff

    If I try to print the contents of VARIABLE in another shell, I get:

    mislav@mislavovo-racunalo:~$ echo $VARIABLE

    What’s that I get? An empty line. Because in another shell (in another Terminal window), the variable VARIABLE doesn’t exist.

    Hope you learned something useful!

    References

    Ward, B. (2014). How Linux Works: What Every Superuser Should Know (2nd ed.). No Starch Press. Pages 21-22