← Back to team overview

sslug-teknik team mailing list archive

Re: ett enkelt script?

 

On Sat, Jan 07, 2006 at 03:06:30PM +0000, Jørgen Heesche wrote:
....

> >Kære Mogens og andre
> >
> >Jeg vil mene at forklaringen snarere er at [ er et program!
> > ~ $ ls -l /usr/bin/[
> >- -rwxr-xr-x  1 root root 25592 Jun  1  2005 /usr/bin/[
> >surprise? Jeg var i hvert fald engang.
> >Som alle programmer skal [ være adskilt fra sine argumenter af et
> >mellemrum.
> >En gang var [ linket til programmet test, men det er det i hvert
> >fald ikke længere på min Linux (Gentoo)

Det gælder også debian/sarge, og er sikkert sådan for flere.
Det undrer mig dog at det nu er separate programmer , jeg syntes at huske
at det oprindelig var samme filer med hard-link.


> Måske har Gentoo kopieret filen /usr/bin/test til /usr/bin/[ eller 
> defineret en alias [='test'.
> Iflg. http://gentoo-wiki.com/MAN_bash har Gentoo en builtin [
> Citat:
>      Conditional expressions are used by .... and
>      the test and [ builtin commands to test ...

Det er standard i Bash, og har sikkert været det længe det står 
også i manualen, det kan dog slås fra/til med ekstern kommando:

..snip...
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.
  If -n is used, each name is disabled; otherwise, names are enabled.  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 builtin  command  name  from
  shared object filename, on systems that support dynamic loading.  The -d option will
  delete a builtin previously loaded with -f.  If no name arguments are given, or if the
  -p option is supplied, a list of shell builtins is printed.  With no other option
  arguments, the list consists of all enabled shell
.....


-- 
mvh Frank Damgaard  | 



References