home *** CD-ROM | disk | FTP | other *** search
/ PCNET 2006 September - Disc 1 / PCNET_CD_2006_09.iso / linux / puppy-barebones-2.01r2.iso / pup_201.sfs / usr / local / bin / defaulthandler < prev    next >
Encoding:
Text File  |  2005-10-04  |  766 b   |  42 lines

  1. #!/bin/sh
  2. #barryk 2005
  3.  
  4. AFILE="`basename "$1"`"
  5.  
  6. if [ "`echo -n "$AFILE" | grep '\.'`" = "" ];then
  7.  /usr/local/bin/defaulttexteditor "$1"
  8.  exit
  9. else
  10.  AEXT="$AFILE"
  11.  while [ ! "`echo -n "$AEXT" | grep '\.'`" = "" ];do
  12.   AEXT="`echo -n "$AEXT" | cut -f 2-6 -d '.'`"
  13.  done
  14. fi
  15.  
  16. #this needs to be fleshed out a bit more...
  17. case $AEXT in
  18.  txt|TXT)
  19.   /usr/local/bin/defaulttexteditor "$1"
  20.   ;;
  21.  doc|DOC|rtf|RTF)
  22.   /usr/local/bin/defaultwordprocessor "$1"
  23.   ;;
  24.  xls|XLS)
  25.   /usr/local/bin/defaultspreadsheet "$1"
  26.   ;;
  27.  htm|html|HTM|HTML)
  28.   /usr/local/bin/defaulttexteditor "$1"
  29.   ;;
  30.  png|PNG|gif|GIF|jpg|JPG|jpeg|JPEG|xpm|XPM)
  31.   /usr/local/bin/defaultpaint "$1"
  32.   ;;
  33.  pdf|PDF|ps|PS|eps|EPS)
  34.   gsview "$1"
  35.   ;;
  36.  *)
  37.   /usr/local/bin/defaulttexteditor "$1"
  38.   ;;
  39. esac
  40.  
  41. ###END###
  42.