|
Last change
on this file was
8645,
checked in by westram, 14 years ago
|
|
|
-
Property svn:eol-style set to
native
-
Property svn:executable set to
*
-
Property svn:keywords set to
Author Date Id Revision
|
|
File size:
1.9 KB
|
| Line | |
|---|
| 1 | #!/bin/bash |
|---|
| 2 | |
|---|
| 3 | IS_X_EDITOR=0 |
|---|
| 4 | |
|---|
| 5 | if [ -z "$ARB_TEXTEDIT" ]; then |
|---|
| 6 | echo '$ARB_TEXTEDIT is not defined - searching for an editor..' |
|---|
| 7 | echo '' |
|---|
| 8 | |
|---|
| 9 | # try to find an editor (order = basic to convenient; last found is used): |
|---|
| 10 | if [ -x "`which edit`" ] ; then ARB_TEXTEDIT=edit; IS_X_EDITOR=0; fi |
|---|
| 11 | if [ -x "`which editor`" ] ; then ARB_TEXTEDIT=editor ; IS_X_EDITOR=0; fi |
|---|
| 12 | if [ -x "`which vi`" ] ; then ARB_TEXTEDIT=vi ; IS_X_EDITOR=0; fi |
|---|
| 13 | if [ -x "`which vim`" ] ; then ARB_TEXTEDIT=vim ; IS_X_EDITOR=0; fi |
|---|
| 14 | |
|---|
| 15 | if [ -x "`which emacs`" ] ; then ARB_TEXTEDIT=emacs ; IS_X_EDITOR=1; fi |
|---|
| 16 | if [ -x "`which xemacs`" ] ; then ARB_TEXTEDIT=xemacs ; IS_X_EDITOR=1; fi |
|---|
| 17 | if [ -x "`which xedit`" ] ; then ARB_TEXTEDIT=xedit ; IS_X_EDITOR=1; fi |
|---|
| 18 | if [ -x "`which textedit`" ] ; then ARB_TEXTEDIT=textedit; IS_X_EDITOR=1; fi |
|---|
| 19 | if [ -x "`which kwrite`" ] ; then ARB_TEXTEDIT=kwrite ; IS_X_EDITOR=1; fi |
|---|
| 20 | if [ -x "`which kate`" ] ; then ARB_TEXTEDIT=kate ; IS_X_EDITOR=1; fi |
|---|
| 21 | if [ -x "`which gedit`" ] ; then ARB_TEXTEDIT=gedit ; IS_X_EDITOR=1; fi |
|---|
| 22 | |
|---|
| 23 | if [ -z "$ARB_TEXTEDIT" ]; then |
|---|
| 24 | echo "Can't guess an editor. Even 'vi' seems to be absent." |
|---|
| 25 | echo "Please set the environment variable \$ARB_TEXTEDIT to the" |
|---|
| 26 | echo "name of your preferred text editor." |
|---|
| 27 | echo "" |
|---|
| 28 | echo "Press ENTER to continue.." |
|---|
| 29 | read x |
|---|
| 30 | exit 1; |
|---|
| 31 | fi |
|---|
| 32 | echo '' |
|---|
| 33 | echo "Using '$ARB_TEXTEDIT' as text editor." |
|---|
| 34 | fi |
|---|
| 35 | |
|---|
| 36 | if [ -z "$1" ]; then |
|---|
| 37 | echo "Usage: arb_textedit filename" |
|---|
| 38 | echo "Edits a file using $ARB_TEXTEDIT" |
|---|
| 39 | else |
|---|
| 40 | if [ $IS_X_EDITOR = 1 ]; then |
|---|
| 41 | $ARB_TEXTEDIT $1 |
|---|
| 42 | else |
|---|
| 43 | ${ARB_XCMD:-xterm -geometry 120x50 -e} $ARB_TEXTEDIT $1 |
|---|
| 44 | fi |
|---|
| 45 | fi |
|---|
Note: See
TracBrowser
for help on using the repository browser.