-
-
Save zanshin/dcc831304d8e3213ceed6e0346fa755c to your computer and use it in GitHub Desktop.
Bash path function to display a neatly formatted and color coded path breakdown
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
path() { | |
local blue="\033[1;34m" | |
local green="\033[0;32m" | |
local cyan="\033[0;36m" | |
local purple="\033[0;35m" | |
local brown="\033[0;33m" | |
local reset_color="\033[0m" | |
echo $PATH | tr ":" "\n" | \ | |
awk "{ sub(\"/usr\", \"$green/usr$reset_color\"); \ | |
sub(\"/bin\", \"$blue/bin$reset_color\"); \ | |
sub(\"/opt\", \"$cyan/opt$reset_color\"); \ | |
sub(\"/sbin\", \"$purple/sbin$reset_color\"); \ | |
sub(\"/local\", \"$brown/local$reset_color\"); \ | |
print }" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment