Export The $PATH Variable, Line-By-Line
Bash/Coreutils, 17 16 bytes
tr : '
'<<<$PATH
Z shell (zsh), 13 bytes
<<<${(F)path}
Uses the $path
parameter, which is a special array parameter used by the shell that is tied to the $PATH
parameter, and a parameter expansion flag to join an array with newlines.
Batch, 41 bytes
@for %%a in ("%PATH:;=";"%")do @echo %%~a
PATH
is semicolon-delimited on Windows of course. Conveniently, for
splits on semicolons by default, but inconveniently, also on spaces, so I have to use string replace trickery to quote each path element before splitting. It then remains to remove the quotes afterwards.