On Tue, 2007-10-02 at 18:30 +0200, George Shapovalov wrote:
> Tuesday, 2. October 2007, Roy Marples Ви написали:
> > And here it is
> -       if [[ "${FORTRANC}" = "gfortran" ]]; then
> +       if [ "${FORTRANC}" = "gfortran" ]; then
> 
> You know, it is funny to see these lines after all those cries about how [ is 
> evil and we should really never ever use it but rather always use [[ form :).
> 
> Oh, btw, does the compliant sh correctly process the most cited composition? :
> [ -n $foo ] && [ -z $foo ] && echo "huh?"
> (straight from devmanual, the primary reason why [ is  considered bad)

bash and sh do the same thing
[EMAIL PROTECTED] ~ $ bash -c '[ -n $foo ] && [ -z $foo ] && echo "huh?"'
huh?
[EMAIL PROTECTED] ~ $ sh -c '[ -n $foo ] && [ -z $foo ] && echo "huh?"'
huh?

Maybe if you quoted properly it would work?
[EMAIL PROTECTED] ~ $ bash -c '[ -n "$foo" ] && [ -z "$foo" ] && echo
"huh?"'
[EMAIL PROTECTED] ~ $ sh -c '[ -n "$foo" ] && [ -z "$foo" ] && echo "huh?"'

By golly it does work!
And on both shells!
Amazing!

With [[ ]] you don't need to quote, which encourages people not to
bother learning when and when not to quote.

Regular readers of -dev will also notice a large amount of people not
quoting correctly, my view is that bash encourages this through the use
of [[ ]].

Thanks

Roy

-- 
[EMAIL PROTECTED] mailing list

Reply via email to