Skip to content

Instantly share code, notes, and snippets.

@pinebright
Created May 8, 2020 05:33
Show Gist options
  • Save pinebright/aaa109f27b700a6de18f7194c80f392f to your computer and use it in GitHub Desktop.
Save pinebright/aaa109f27b700a6de18f7194c80f392f to your computer and use it in GitHub Desktop.
bashでLS_COLORSをチェックするスクリプト
#!/usr/bin/env bash
IFS=:
for item in ${LS_COLORS}; do
color="$(echo ${item} | awk -F= '{print $2}')"
name="$(echo ${item} | awk -F= '{print $1}')"
case ${name} in
"no") name="global default";;
"fi") name="normal file";;
"di") name="directory";;
"ln") name="symbolic link";;
"pi") name="named pipe";;
"so") name="socket";;
"do") name="door";;
"bd") name="block device";;
"cd") name="character device";;
"or") name="orphan symlink";;
"mi") name="missing file";;
"su") name="set uid";;
"sg") name="set gid";;
"tw") name="sticky other writable";;
"ow") name="other writable";;
"st") name="sticky";;
"ex") name="executable";;
esac
printf '\e[%sm%s\e[m\n' ${color} ${name}
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment