]> git.donarmstrong.com Git - bin.git/blob - sane_editor
add reset usb bus command
[bin.git] / sane_editor
1 #!/bin/sh
2
3 # Order of preference
4 # gnuclient
5 # jed
6 # juno
7 # vi
8 # nano
9 # ed
10
11 # modify the gsrvdir check to search for directories that are owned by me
12 if [ -x /usr/bin/emacsclient ] && [ -x /usr/bin/emacs ]; then
13     # reset the tempdir to deal with setuid things clearing it
14     export TMPDIR="$(echo ~/tmp)";
15     # If TERM is set to dumb, reset it to linux. (emacs does this for
16     # some reason)
17     if [ "$TERM" = "dumb" ]; then
18         TERM="linux"
19     fi;
20     if [ -z "$DISPLAY" ]; then
21             exec emacsclient --alternate-editor /usr/bin/vi -c -nw "$@";
22     else
23             exec emacsclient --alternate-editor /usr/bin/vi -c "$@";
24     fi;
25 fi;
26 if [ -x /usr/bin/gnuclient ] && [ -x /usr/bin/emacs ]; then
27     if ( gnuclient -batch < /dev/null >/dev/null); then
28         exec gnuclient "$@";
29     fi;
30 fi;
31 if [ -x /usr/bin/vi ]; then
32     exec vi "$@";
33 fi;
34 if [ -x /usr/bin/nano ]; then 
35     exec nano "$@";
36 fi;
37 if [ -x /usr/bin/ed ]; then
38     exec ed "$@";
39 fi;
40 echo "Unable to find a suitable editor" >/dev/stderr;
41 exit 1;