Today I Learned
Search…
Print value of `$PATH` in readable format
Posted on 10 Aug, 2021
1
# for bash
2
echo "${PATH//:/#x27;\n'}"
3
# for zsh omit the $ char
4
echo "${PATH//:/'\n'}"
Copied!
Substitute all occurrences of ":" in $PATH with a newline "\n"
  • The #x27;...' way of quoting a string allows us to use special characters such as tab () safely.

Resources

Copy link
Edit on GitHub
Contents