This is a Debian-ism (and therefore appears in Ubuntu, Mint, etc.). They've setup a link called editor
. You can trace it back as follows:
$ which editor
/usr/bin/editor
$ ls -l /usr/bin/editor
lrwxrwxrwx 1 root root 24 Nov 24 19:10 /usr/bin/editor -> /etc/alternatives/editor
$ ls -l /etc/alternatives/editor
lrwxrwxrwx 1 root root 18 Nov 24 19:46 /etc/alternatives/editor -> /usr/bin/vim.gnome
$ ls -l /usr/bin/vim.gnome
-rwxr-xr-x 1 root root 2403392 Oct 26 2012 /usr/bin/vim.gnome
So you can see that editor
is just a Unix link to the executable vim.gnome
.
Using editor
?
I don't think I'd go in that direction of setting up editor
in any meaningful way for users, given it's not what I would consider standard.
Additionally you can set the $EDITOR
environment variable to point to anything you want, vim
, gedit
, emacs
, etc. But this variable is only guaranteed to be used by other tools such as sudo
, git
, and subversion
that are specifically designed to be tied into using the variable $EDITOR
.
Implementation ideas
I would merely setup an alias of your own choice and either instruct the users that it's available to them via their $HOME/.bashrc
file as alias X, or set it up as a system configuration in the file /etc/profile.d/our_aliases.sh
, as alias X.
Or you could just tell users that the systems' provide gedit
, gvim
, vim
, emacs
, etc. and cut through the sugar coating and teach them about these things right off the bat.
Or you could provide a text file called /etc/help.txt
which they could run via a command help
(alias help="less /etc/help.txt"
) in a shell that would provide basic commands and how to perform various tasks. This approach allows you to customize the help as time goes by with new features or tips and it gives them more than just the editor
convenience command.
The default login shell for AIX is not bash - it is ksh/posix. The reason why the "up" arrow isn't working is because KSH is set to "vi" mode (bash can do this too). You want "emacs" mode:
set -o emacs
The .bashrc equivalent is .profile. You can put the above in there to change it permanently. AIX actually gives you two versions of KSH - ksh88 (default) and ksh93. The latter supports .kshrc as well
You can also install bash (and vim, nano etc) on AIX using an RPM available from one of the publicly available repositories.
Best Answer
You can use
$EDITOR
, provided that it's been defined:But I think most docs use
nano
because if someone's blindly following along, it's a safe bet to use. If the user has decided they actually prefer one editor over another, they'll know enough to replace it withvim
,emacs
, etc themselves.edit
may work well on Debian-based systems, but on others it invokesex
, which isn't recommended.