Re: check, that a script is in a folder
thank you, the:
if ! [ "${PWD##*/}" == "asdf" ]; then echo "error: not the asdf dir"; exit 1; fi
worked! :)
--- On Wed, 1/5/11, Pascal Hambourg <pascal.mail@plouf.fr.eu.org> wrote:
> From: Pascal Hambourg <pascal.mail@plouf.fr.eu.org>
> Subject: Re: check, that a script is in a folder
> To: debian-user@lists.debian.org
> Date: Wednesday, January 5, 2011, 10:47 AM
> Hello,
>
> S Mathias a écrit :
> > $ if "${PWD##*/}" -eq "asdf" > /dev/null; then echo
> "this is the asdf folder"; else exit 1; fi
> > bash: notthatfolder: command not found...
> > this is the asdf folder
> >
> > What's wrong with my one-liner?
>
> Two mistakes :
> 1) "if" expects a command, not a boolean expression. Use
> "test
> <expression>" or "[ <expression> ]" to evaluate
> the expression.
> 2) "-eq" is the equal operator for numeric integers, not
> strings. Use
> "=" for string comparison.
>
>
> --
> To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
>
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> Archive: [🔎] 4D244C40.7040406@plouf.fr.eu.org">http://lists.debian.org/[🔎] 4D244C40.7040406@plouf.fr.eu.org
>
>
Reply to: