Roy Marples <[EMAIL PROTECTED]> wrote:
> On Tuesday 07 November 2006 15:59, Aron Griffis wrote:
> > > +if [[ $'\n'$(get_mounts) =~ $'\n'${svcdir}\  && -w ${svclib} ]] ; then
> >
> > Shouldn't this be:
> >
> >     if [[ $'\n'$(get_mounts) == $'\n'"${svcdir} " ...
> >
> > because I don't think you want to treat the RHS as either a regex
> > (=~) or a glob (unquoted).
> 
> Needs to be regex so I can match $'\n' as iirc you loose that in
> globbing

I could be missing something, but:

[[ $'\nwombat' =~ $'wombat' ]] && \
echo "These compare as equal, with or without the leading \n"

They do not compare as equal with the == operator or the = operator. You
probably want the = operator, because the == operator _does_ interpret
the RHS as a glob. The = operator just uses simple string comparison,
without interpreting anything.



I am curious about why the space was included at the end of the in the
expression:

> > > $'\n'${svcdir}\ 

Does get_mounts add a space to the end of its output?

-- 
Every absurdity has a champion to defend it.
  -- Oliver Goldsmith

Attachment: pgpzmDvJMG5B3.pgp
Description: PGP signature

Reply via email to