S Mathias a écrit :
>
> if ! [ "${PWD##*/}" == "asdf" ]; then echo "error: not the asdf dir"; exit 1;
> fi
Note that "==" is a bashism. "=" is more portable across other shells
such as dash.
--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of "unsubscribe". Tro
thank you, the:
if ! [ "${PWD##*/}" == "asdf" ]; then echo "error: not the asdf dir"; exit 1; fi
worked! :)
--- On Wed, 1/5/11, Pascal Hambourg wrote:
> From: Pascal Hambourg
> Subject: Re: check, that a script is in a folder
> To: debian-user@lists.
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 express
On Wed, Jan 05, 2011 at 02:27:39AM -0800, S Mathias wrote:
> $ echo ${PWD##*/}
> somefolder
> $ if "${PWD##*/}" -eq "asdf" > /dev/null; then echo "this is the asdf
> folder"; else exit 1; fi
if [ "${PWD##*/}" == "asdf" ]; then echo "this is the asdf folder"; else exit
1; fi
Why not simple use:
t;asdf"
What's wrong with my one-liner?
I just want to check, that a script is in a folder, and if it isn't, then it
exits
--
To UNSUBSCRIBE, email to debian-user-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.d
5 matches
Mail list logo