On 15.02.2011 11:13, Ferenc Wagner wrote:
> Peter Wagner <tripo...@gmx.at> writes:
> 
>> -       [ -n "$leasefile" ] && [ -e "$leasefile" ] || touch "$leasefile"
>> +       [ -n "$leasefile" ] && ( [ -e "$leasefile" ] || touch "$leasefile" )
> 
> Looks like this is fixed already by commit 15fba44a (but see point 6 of
> http://mywiki.wooledge.org/BashPitfalls and the rest for an interesting
> read) so the following is academic, but I typed it before checking...
> 
> It's cheeper to use braces in such cases to avoid subshell creation:
> 
>           [ -n "$leasefile" ] && { [ -e "$leasefile" ] || touch "$leasefile"; 
> }
> 

command grouping is the way to go, right

> Btw. is the -e test really necessary?  Why not simply
> 
>           [ -n "$leasefile" ] && touch "$leasefile"
> ?

depends on what is more expensive .. the test or the touch, but i doubt the 
research is worth the effective result.

ede

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

Reply via email to