Hi all,

A common workaround for this is to use

[ "x$var" == "x" ] instead of [ -z "$var" ]

and

[ "x$var" != "x" ] instead of [ -n "$var" ]

which doesn't exhibit the mentioned problem.

Regards,
Aleksandar

Alina Friedrichsen wrote:
> Hi!
>
>   
>> Thanks for explaining.. this makes perfectly sense and would be right if
>> the metacharacter hadn't been enclosed in quotes. This should help the
>> interpreter on its feet again.. shouldn't it?
>>     
>
> No the test utility or it's alias [ is designed as a normal external command 
> like every other command line tool in UNIX.
>
> instead of
> x='='
> if [ -n "$x" ]; then
>     true
> fi
> you can write
> x='='
> if /usr/bin/test -n "$x"; then # or maybe /bin/test
>     true
> fi
>
> The quotes aren't passed to it like to every other command line tool.
>
> There are 2 Arguments, argument 1 is -n and argument 2 is =, that are all 
> informations that are passed to test, no quotes.
>
> Regards
> Alina
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel@lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
>
>
>   


_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to