[prog] bash: string comparisons in conditionals

dominik schramm dominik.schramm at gmxpro.net
Fri Apr 23 15:01:37 EST 2004


Hi Riccarda,

I think the time has come for me to jump in on one of *your* 
threads, too. ;-)

"Riccarda Cassini" <riccarda.cassini at gmx.de> writes:

> Conor Daly wrote:
> > AIUI, test is not a bash builtin;
> > 
> > [cdaly at bofh cdaly]$ which [
> > /usr/bin/[
> > [cdaly at bofh cdaly]$ ls -l /usr/bin/[
> > lrwxrwxrwx    1 root     root            4 Nov  4 11:56 /usr/bin/[ -> test
> > 
> > 
> > Since you're calling 'test' as '[', should you be looking for '[' in
> > strace's output rather than 'test'?  I don't know, just wondering.
> 
> Actually, I did try both variants... same result: no trace of 'test'
> or '[' whatsoever (also no exec*() other than the main script...).
> 
> But what's that /usr/bin/[  then for?  Hm... maybe for some other
> ancient shells?

This is from the builtins(1) man page (i.e. bash builtins):

enable [-adnps] [-f filename] [name ...]
    Enable and disable builtin shell commands.  Disabling a builtin
    allows a disk command which has the same name as a shell builtin
    to be executed without specifying a full pathname, even though the
    shell normally searches for builtins before disk commands.  [...]
    For example, to use the test binary found via the PATH instead of
    the shell builtin version, run ``enable -n test''.  The -f option
    means to load the new

hope this helps you with your efforts,
dominik



More information about the Programming mailing list