zsh-users
 help / color / mirror / code / Atom feed
* twisted braces
@ 2005-07-24  6:46 zzapper
  2005-07-24  9:42 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: zzapper @ 2005-07-24  6:46 UTC (permalink / raw)
  To: zsh-users

Hi,
I got into a twist recently with conditional braces ie if (( [[ and [

My problems were solved by using the single [.
I read in the doc that (( was no longer recommended?
>From my Bash days I seem to think [[ was required for substring matching?

Comments?

-- 
zzapper
vim -c ":%s%s*%Cyrnfr)fcbafbe[Oenz(Zbbyranne%|:%s)[[()])-)Ig|norm Vg?"
http://www.rayninfo.co.uk/tips/ vim, zsh & success tips


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: twisted braces
  2005-07-24  6:46 twisted braces zzapper
@ 2005-07-24  9:42 ` Bart Schaefer
  0 siblings, 0 replies; 2+ messages in thread
From: Bart Schaefer @ 2005-07-24  9:42 UTC (permalink / raw)
  To: zsh-users

On Jul 24,  7:46am, zzapper wrote:
}
} I got into a twist recently with conditional braces ie if (( [[ and [

(( ... )) is not for conditional expressions, it's for arithmetic.  It
happens that the results of arithmetic can be tested with "if" et al.,
but that's not its primary purpose.

} My problems were solved by using the single [.

That probably means you needed filename generation or another operation
that occurs for ordinary commands.

} I read in the doc that (( was no longer recommended?

Where?  Quote, please.  If true, that should be repaired.

} From my Bash days I seem to think [[ was required for substring matching?

[[ ... ]] is a true syntactic construct whereas [ ... ] is merely a
command (a synonym for "test ...").  Therefore the shell applies very
different rules inside [[ ... ]], one of which is that comparisons
use pattern matching and another of which is that filename generation
is not performed (so that glob patterns can be used for comparisons).

} Comments?

RTFM?

In particular, the sections "Shell Grammar" and "Conditional Expressions".


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-07-24  9:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-24  6:46 twisted braces zzapper
2005-07-24  9:42 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).