/usr/bin/select-editor is in sensible-utils 0.0.6ubuntu2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | #!/bin/sh
# To generate localization information, run:
# xgettext -o - -L Shell select-editor
PATH=$PATH:/usr/sbin
# Ensure that $HOME/.selected_editor is writeable
touch $HOME/.selected_editor || exit 1
editors=`update-alternatives --list editor | wc -l`
if [ $editors -gt 1 ]; then
echo
echo "`gettext 'Select an editor. To change later, run'`" "'select-editor'."
i=0
editors=`update-alternatives --list editor`
for e in $editors; do
i=`expr $i + 1`
desc=
if [ $e = "/bin/nano" ]; then
desc=" <---- ` gettext 'easiest'`"
simple=$i
fi
echo " $i. $e$desc"
done
echo ""
selected=x
while /bin/true; do
if [ -z "$selected" -a ! -z "$simple" ]; then
selected="$simple"
elif ! test $selected -gt 0 2>/dev/null; then
read -p "`gettext 'Choose'` 1-$i [$simple]: " -r selected
elif ! test $selected -le $i 2>/dev/null; then
read -p "`gettext 'Choose'` 1-$i [$simple]: " -r selected
else
break
fi
done
i=0
for e in $editors; do
i=`expr $i + 1`
if [ $i -eq $selected ]; then
echo "# Generated by /usr/bin/select-editor" > $HOME/.selected_editor
echo "SELECTED_EDITOR=\"$e\"" >> $HOME/.selected_editor && exit 0
fi
done
fi
exit 1
|