Yes, it is routine (but well done for realizing that it can be done). For example:
$ (cd /usr/bin; ls -li | grep -w vim)
2704450 lrwxr-xr-x 1 root wheel 3 Oct 31 2013 ex -> vim
2704451 lrwxr-xr-x 1 root wheel 3 Oct 31 2013 rview -> vim
2704452 lrwxr-xr-x 1 root wheel 3 Oct 31 2013 rvim -> vim
2378579 lrwxr-xr-x 1 root wheel 3 Oct 31 2013 vi -> vim
2704453 lrwxr-xr-x 1 root wheel 3 Oct 31 2013 view -> vim
2343880 -rwxr-xr-x 1 root wheel 1472736 Oct 31 2013 vim
2704454 lrwxr-xr-x 1 root wheel 3 Oct 31 2013 vimdiff -> vim
$
So, the vim
executable can also be invoked as vimdiff
or view
or vi
or ex
and it will behave differently depending on how it is invoked. On some systems, these will be hard links instead of symlinks (the data is from Mac OS X 10.9.2 Mavericks), so you'd need to grep
for the inode number instead of vim
.
Another example:
Bash operates differently when invoked as bash
compared with when it is invoked as sh
. Classically, shells recognize when they're invoked with a dash -
in front of their name (-sh
, -bash
, etc), and act as login shells when you do that:
$ ps
PID TTY TIME CMD
39301 ttys000 0:01.30 -bash
46766 ttys001 0:00.24 -bash
$