Created
January 19, 2017 09:16
-
-
Save stiplady/78b302e4664242dbf7f6c08eb6c92d82 to your computer and use it in GitHub Desktop.
Shows colours for each type of LS_COLORS
This file contains hidden or 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
| #!/bin/bash | |
| # Script to show the colours used for different file types | |
| # This is just a more readable version of the 'eval' code at: | |
| # http://askubuntu.com/a/17300/309899 | |
| # A nice description of the colour codes is here: | |
| # http://askubuntu.com/a/466203/309899 | |
| IFS=: | |
| for SET in $LS_COLORS | |
| do | |
| TYPE=$(echo $SET | cut -d"=" -f1) | |
| COLOUR=$(echo $SET | cut -d"=" -f2) | |
| case $TYPE in | |
| no) TEXT="Global default";; | |
| fi) TEXT="Normal file";; | |
| di) TEXT="Directory";; | |
| ln) TEXT="Symbolic link";; | |
| pi) TEXT="Named pipe";; | |
| so) TEXT="Socket";; | |
| do) TEXT="Door";; | |
| bd) TEXT="Block device";; | |
| cd) TEXT="Character device";; | |
| or) TEXT="Orphaned symbolic link";; | |
| mi) TEXT="Missing file";; | |
| su) TEXT="Set UID";; | |
| sg) TEXT="Set GID";; | |
| tw) TEXT="Sticky other writable";; | |
| ow) TEXT="Other writable";; | |
| st) TEXT="Sticky";; | |
| ex) TEXT="Executable";; | |
| *) TEXT="${TYPE} (TODO: get description)";; | |
| esac | |
| printf "Type: %-10s Colour: %-10s \e[${COLOUR}m${TEXT}\e[0m\n" ${TYPE} ${COLOUR} | |
| done |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/gkotian/gautam_linux/blob/master/scripts/colours.sh