On 5/23/07, Marek Bernat <[EMAIL PROTECTED]> wrote:
On 5/23/07, Sander van Dijk <[EMAIL PROTECTED]> wrote:
>
> And the emacs comparison isn't nonsensical, it's just an exaggeration;
> one could argue to builtin emacs with the exact same arguments as
> mainly used for "test" and "[".
No. You can call test from a script 1000 times a second. There's a need for
officiency. You only run emacs once.
The line between the two is clear. test/[ is a language construct, so it's
natural to be inside the language itself.
As for emacs, well, I don't it is a part of the shell ;-)
He, I don't even want emacs on my machine at all ;-)
As for test being a language contruct: is isn't, or at least wasn't
originally. "if" checks what the return value of the call following it
is; in case it is zero, it does something, otherwise it does something
else. For example,
if sleep 1
then
echo successfully slept for one second
else
echo something went wrong while sleeping
fi
is just as valid a statement as an "if test blahblah" statement.
Originally, test was just a program that was quite (and pretty much
only) useful in conjunction with sh(1)'s "if" builtin. Whatever the
argument for building it into current shells, test is not a real part
of the sh(1) language.
Greetings, Sander.