Shell

Environment Variable

I always understood at a higher level how environment variables work. But not low level.

An environment variable is a user-definable value that can affect the way running processes will behave on a computer.

To see all your currently defined Environment Variables:

printenv

Seems like this is like the idea of a lookup table, like when we have a DNS.

echo $VARIABLE
export VARIABLE=value  # for ksh, bash, and related shells

DISPLAY Variable

Learned this from Swapnesh.

If you do X11 forwarding over ssh (by running ssh -X ip@something, and you do echo $DISPLAY, you will see that the value gets set to something random like localhost:10.0.

However, if you don’t do X11 forwarding, the environment variable doesn’t get set.

This is how you get Rviz to run inside the container, because you use the correct $DISPLAY value, which should be :0.