diff options
author | Clint Adams <schizo@debian.org> | 2005-06-21 23:30:25 +0000 |
---|---|---|
committer | Clint Adams <schizo@debian.org> | 2005-06-21 23:30:25 +0000 |
commit | c2a1c435ef5e7d590328802ce333de410ce40cb6 (patch) | |
tree | 6095e344242e76daf58d6d42afc5ca29673d2a0a /sensible-editor | |
download | debianutils-c2a1c435ef5e7d590328802ce333de410ce40cb6.tar.gz |
tag of schizo@debian.org--2004-primary/debianutils--etch--0--version-0
(automatically generated log message)
git-archimport-id: schizo@debian.org--etch/debianutils--etch--0--base-0
Diffstat (limited to 'sensible-editor')
-rw-r--r-- | sensible-editor | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/sensible-editor b/sensible-editor new file mode 100644 index 0000000..fe9e4e1 --- /dev/null +++ b/sensible-editor @@ -0,0 +1,31 @@ +#!/bin/sh + +ret="$?" + +if [ -n "$VISUAL" ]; then + ${VISUAL} "$@" + ret="$?" + if [ "$ret" -ne 126 ] && [ "$ret" -ne 127 ]; then + exit "$ret" + fi +fi + +${EDITOR:-editor} "$@" +ret="$?" +if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then + nano "$@" + ret="$?" + if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then + nano-tiny "$@" + ret="$?" + if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then + vi "$@" + ret="$?" + if [ "$ret" -eq 126 ] || [ "$ret" -eq 127 ]; then + echo "Couldn't find an editor!" 1>&2 + echo "Set the \$EDITOR environment variable to your desired editor." 1>&2 + exit 1 + fi + fi + fi +fi |