home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / usr / bin / sensible-editor < prev    next >
Encoding:
Text File  |  2007-03-05  |  616 b   |  33 lines

  1. #!/bin/sh
  2.  
  3. ret="$?"
  4.  
  5. if [ -n "$VISUAL" ]; then
  6.     ${VISUAL} "$@"
  7.     ret="$?"
  8.     if [ "$ret" -ne 126 ] && [ "$ret" -ne 127 ]; then
  9.         exit "$ret"
  10.     fi
  11. fi
  12.  
  13. ${EDITOR:-editor} "$@"
  14. ret="$?"
  15. if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
  16.     nano "$@"
  17.     ret="$?"
  18.     if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
  19.         nano-tiny "$@"
  20.         ret="$?"
  21.         if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
  22.             vi "$@"
  23.             ret="$?"
  24.             if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then
  25.                 echo "Couldn't find an editor!" 1>&2
  26.                 echo "Set the \$EDITOR environment variable to your desired editor." 1>&2
  27.                 exit 1
  28.             fi
  29.         fi
  30.     fi
  31. fi
  32. exit "$ret"
  33.