Links

Print value of `$PATH` in readable format

Posted on 10 Aug, 2021
# for bash
echo "${PATH//:/$'\n'}"
# for zsh omit the $ char
echo "${PATH//:/'\n'}"
Substitute all occurrences of ":" in $PATH with a newline "\n"
  • The $'...' way of quoting a string allows us to use special characters such as tab () safely.

Resources