On 27-Nov-01 Alexandr Malusek wrote:
Note that the default "which" in SuSE is the bash alias
$ alias which alias which='type -p'
The old "which" command is still there:
$ /usr/bin/which ls /bin/ls
Would someone from SuSE please explain what the point of this
particular alias is?
Since 'which' is there in its own right, why steal its name for
something else?
This strikes me as comparable with the silliness of the default
behaviour of 'less' (due to a daft default '/usr/bin/lessopen.sh'
file which makes altogether too many assumptions about what the
user wants to see -- i.e. whoever put that together has their own
idea of what users should be seeing, which is mostly a long way
from what I usually want to see; and in the process makes it
tricky for users who want the "usual" behaviour to restore it,
indeed to find out what's happening).
Inspired by Alexandr's note above, I did 'alias' (on 7.2), with the
following results:
alias +='pushd .'
alias -='popd'
alias ..='cd ..'
alias ...='cd ../..'
alias A:='echo -e '\''Error: There is no such thing
as a drive A: in Un*x!\n
Use mtools, mount or autofs to access your floppy.'\'''
alias C:='echo -e '\''Error: There is no such thing
as a drive C: in Un*x!\n
Your harddisk should already be mounted (via /etc/fstab
or autofs).'\'''
alias beep='echo -en "\x07"'
alias cd..='echo '\''Error: Try: cd ..'\'''
alias chkdsk='echo -e '\''Error: Your filesystems are
checked on bootup.\n
If you want to do it manually, use fsck.\n
Use df and mount for an overview of your disks.
alias copy='echo '\''Error: Try the command: cp -piv'\'''
alias del='echo '\''Error: Try the command: rm -iv'\'''
alias dir='ls -l'
alias dos2unix='recode ibmpc..lat1'
alias format='echo -e '\''Error: The D*S concept of
formatting a disk is screwed.\n
Maybe you want to create a filesystem? Use mkfs then.'\'''
alias l='ls -alF'
alias la='ls -la'
alias ll='ls -l'
alias ls='ls $LS_OPTIONS'
alias ls-l='ls -l'
alias md='mkdir -p'
alias mem='echo '\''Error: Try the command: free'\'''
alias move='echo '\''Error: Try the command: mv -iv'\'''
alias o='less'
alias rd='rmdir'
alias rehash='hash -r'
alias unix2dos='recode lat1..ibmpc'
alias unmount='echo "Error: Try the command: umount"'
alias ver='echo '\''Error: Try the command: uname -a'\'''
alias which='type -p'
Of these, "+", "-", "..", "...", "beep", perhaps "dir",
"dos2unix", "l", "la", "ll", "md", "rd", "rehash" and "unix2dos"
strike me as (more or less) useful abbreviations; though some
people might prefer to assign some of them to something slightly
different.
I see no point to "o". As to "which", see above.
Now for "A:", "C:". Well, sorry, but I do have "A:", "C:" and
also "D:". Or, more precisely, "/A:", "/C:" and "/D:" -- these
are mount points for, respectively, the floppy drive and for
certain DOS partitions on the hard drives, and are so present
in /etc/fstab. So it is easy to "mount /A:", "cd /C:", etc.;
it's a useful mnemonic for anyone, and (in my experience)
is helpful for DOS users to get used to.
Which also suggests that it would be more to the point to
have commands (aliases or command files) "A:", "C:" etc,
where "A:" would do "mount /A: ; cd /A:", while "C:"
would do "cd /C: and, if "/A:" mounted, unmount it."
That would actually be _useful_, instead of the really
pointless sneering at "ignorant DOS users" which the above
aliases generate -- "Oh, you said 'A:', you must be a DOS
user but look, now you're using **UNIX** which is superior
and you really MUSTN'T use those nasty commands that you've
been used to and which tell us all where you've come from."
The same point about sneering at "DOS users" applies to
"copy", "del", "format", "mem" and "move". Whoever took the
trouble to compose these useless aliases could have taken the
trouble to assign aliases which did something _useful_ instead
-- even something as simple as "alias copy='cp'" or
"alias mem='free'" would be worth while. (A possible exception
would be "format", which if used at all should be a script
which would only work if called as "format A:"; there IS a
point in having UNIX commands which emulate such DOS commands
as are relevant to UNIX).
I can see the point of the "chkdsk" alias (though might
have expressed it differently); probably someone who has
an urge to type "chkdsk" would get their fingers burned
if they dipped them into "fsck".
And if someone's going to take the trouble to compose
the above equally pointless alias for "unmount" then, again,
they might instead take the trouble to make it straightforward and
useful: "alias unmount='umount'" (it's a common enough typo;
I recall that either Brian Kernighan, or Dennis Ritchie, when
asked what he thought was the worst mistake he had made while
developing C/UNIX, replied "leaving the final 'e' off 'creat'").
Dear SuSE: Please stop doing this silly stuff. Much of what I've
criticised above is on the level of practical jokes in a student
computer lab.
It gets in the way of "real" users. As it happens, I had not
done a "which ls" and hadn't noticed this. However, if I had,
I would have had the same initial reaction: that something was
wrong; and it might have taken me quite a bit of time and trouble
to track it down (it doesn't immediately leap to the mind, even
of an experienced user, that a command which doesn't do what
it's supposed to do might actually be an alias instead).
It's totally unnecessary to alias an existing command to
something quite different. Commands are commands. If nothing
else, "man which" gives false information; new users getting
used to UNIX will only get confused and deterred. Frankly,
I expect commands to do what they're "officially" supposed
to do, not what some interfering SuSE apparatchik has seen fit
to change them into. All the more so if the new alias doesn't
behave as "man <command>" describes. If you want a command to
do something different (though related), then for God's
sake give it a different name: it's no more trouble than
aliasing the original command to something which, arguably,
is simply wrong because it doesn't do what it's supposed to.
And, as for DOS users: Please don't treat them like low life.
I've known quite a few become very competent Linux users,
even if they sometimes retain a preference for where they
originated. They will only feel insulted by the ouput of
the likes of "copy" or "del". Remember that people who use
computers a lot, be they DOS or UNIX, have a tendency to
type "on autopilot" when working fast; "alias copy='cp'"
would help them. It would also help people coming from the
"copy" and "move" world who, otherwise, would take some time
to get used to the abbreviations "cp" and "mv" (as I have seen).
I've been sarcastic before about SuSE "Professional".
As far as I can see, "Professional" simply means "In contrast
with 'Personal', you get a lot more applications which could
help you do real work". It does not imply a professional
quality to the way the distribution has been created (though
of course much of what is on the SuSE CDs is indeed of that
quality).
A really professional distribution would quietly create
useful aliases which unobtrusively do useful things in a correct
and reliable manner (see examples above), and would NOT break
the behaviour of things which real professional users expect
to behave in a particular way (e.g. because of what they
read in the man pages). "Student pranks" are not professional.
Best wishes to all,
Ted.
--------------------------------------------------------------------
E-Mail: (Ted Harding)