kfl62 kfl62 - 9 days ago 6
Bash Question

Environment variables in symbolic links

Can we use $HOME or other environment variable in symbolic links?

I know about using relative paths

../../.config
but sometimes are to many
../
:) something like
~/.config
would be more comfortable, or use of $HOME.

Edit:

habbie's answer with psmears's comment is the answer, sorry my question was incomplete.

While (as other answers show) you can use environment variables when creating symbolic links (as with any shell command!), you can't actually have environment variable (or '~') references in the symlink itself

Answer

Symbolic links are handled by the kernel, and the kernel does not care about environment variables. So, no.

Comments