Today I Learned
Search…
Print value of `$PATH` in readable format
Posted on 10 Aug, 2021
# for bash
echo "${PATH//:/#x27;\n'}"
# for zsh omit the $ char
echo "${PATH//:/'\n'}"
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