[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: POSIX scripting tip



phil@bolthole.com (Philip Brown) writes:

> Miguel Wooding (mwooding@thecity.sfsu.edu) wrote:
> > Philip Brown <phil@bolthole.com> wrote:
> > >
> > > If you have files
> > > fiftyfive fiftyfour fiftyone fiftysix fiftythree fiftytwo
> > 
> > > $ ls fifty?(one|f*)
> > 
> > > will result in
> > 
> > > fiftyfive   fiftyfour   fiftyone
> > [...]
> >It doesn't seem to have "sneaked in" at all. In bash:
> >$ touch ffive ffour fone fsix fthree ftwo
> >$ ls
> >ffive  ffour  fone  fsix  fthree  ftwo
> >$ ls f?(one|f*)
> >bash: syntax error near unexpected token `f?(o'
> 
> I specified that the above was a feature of **POSIX** sh.
> Bash is not a POSIX-compliant shell.
> 
> [hence it is a Bad Thing that /bin/sh is a link to /bin/bash]
> 
> (Mind you, I am guessing a bit that it in the actual POSIX spec.
>  I know it's in the KSH spec, which mostly defines POSIX-sh, and
> 
>  /usr/xpg4/bin/sh
> 
>  under solaris  supports    ls f?(xxxxx)  syntax.
>  So it's a fairly well-founded guess ;-)

It doesn't work under ash either.  Just another data point.  Perhaps
it's time to look at the POSIX spec.

$ ash
$ touch  ffour  fone  fsix  fthree  ftwo
$ ls
ffour  fone  fsix  fthree  ftwo
$  ls f?(one|f*)
Syntax error: "(" unexpected



Reply to: