daily pastebin goal
53%
SHARE
TWEET

Untitled

a guest Jan 13th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. # For LS_COLORS, print type and description in the relevant color.
  3.  
  4. IFS=:
  5. for ls_color in $LS_COLORS; do
  6.     color="${ls_color#*=}"
  7.     type="${ls_color%=*}"
  8.  
  9.     # Add descriptions for named types.
  10.     case "$type" in
  11.     bd) type+=" (block device)" ;;
  12.     ca) type+=" (file with capability)" ;;
  13.     cd) type+=" (character device)" ;;
  14.     di) type+=" (directory)" ;;
  15.     do) type+=" (door)" ;;
  16.     ex) type+=" (executable file)" ;;
  17.     fi) type+=" (regular file)" ;;
  18.     ln) type+=" (symbolic link)" ;;
  19.     mh) type+=" (multi-hardlink)" ;;
  20.     mi) type+=" (missing file)" ;;
  21.     no) type+=" (normal non-filename text)" ;;
  22.     or) type+=" (orphan symlink)" ;;
  23.     ow) type+=" (other-writable directory)" ;;
  24.     pi) type+=" (named pipe, AKA FIFO)" ;;
  25.     rs) type+=" (reset to no color)" ;;
  26.     sg) type+=" (set-group-ID)" ;;
  27.     so) type+=" (socket)" ;;
  28.     st) type+=" (sticky directory)" ;;
  29.     su) type+=" (set-user-ID)" ;;
  30.     tw) type+=" (sticky and other-writable directory)" ;;
  31.     esac
  32.  
  33.     # Separate each color with a newline.
  34.     if [[ $color_prev ]] && [[ $color != $color_prev ]]; then
  35.         echo
  36.     fi
  37.  
  38.     printf "\e[%sm%s\e[m " "$color" "$type"
  39.  
  40.     # For next loop
  41.     color_prev="$color"
  42. done
  43. echo
  44. # Additional information 'dircolors -p' and 'man dir_colors'
RAW Paste Data
Top