Last active
August 29, 2015 13:57
-
-
Save mfdj/9726938 to your computer and use it in GitHub Desktop.
view $PATH (or any colon separated string) as a readable multiline output — tested on OSX bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##### first attempt | |
# one-liner | |
echo $PATH | sed -e "s~:~\\`echo -e '\n\r'`~g" | |
# bash function | |
sep2ln() | |
{ | |
local INPUT=$1 | |
local SEPARATOR=$2 | |
echo "$INPUT" | sed -e "s~${SEPARATOR}~\\`echo -e '\n\r'`~g" | |
} | |
sep2ln $PATH : | |
##### cleaner | |
# one-liner | |
echo $PATH | sed -e s~:~'\'$'\n'~g | |
# ignore the weird color problem; | |
# i think githubs syntax parser is getting confused | |
# bash function | |
sep2ln() | |
{ | |
local INPUT=$1 | |
local SEPARATOR=$2 | |
echo "$INPUT" | sed -e "s~$SEPARATOR~"'\'$'\n'~g | |
} | |
sep2ln $PATH : |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment