zsh-users
 help / color / mirror / code / Atom feed
* ${var: -1:1} vs. ${var:-1:1}
@ 2012-11-17 21:10 Ray Andrews
  2012-11-17 21:48 ` Moritz Bunkus
  0 siblings, 1 reply; 5+ messages in thread
From: Ray Andrews @ 2012-11-17 21:10 UTC (permalink / raw)
  To: zsh-users

I just wasted an hour trying to extract the last character from a 
string. My problem was that I did: "${var:-1:1}" and didn't put a space 
in front of the minus sign.  Bash has the same problem, so this isn't a 
zsh specific issue, but I'd feel a lot better if someone could explain 
why that space is necessary. All the shells seem to have these little 
gotchas with spaces. Sometimes they're ignored, sometimes mandatory and 
sometimes forbidden. It sure is a PITA.  I can only compare this to C, 
where such problems are nonexistent. If there is some sort of master 
plan governing spacing, I'd sure like to know what it is.

Thanks, sorry to bitch.


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

end of thread, other threads:[~2012-11-18  2:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-17 21:10 ${var: -1:1} vs. ${var:-1:1} Ray Andrews
2012-11-17 21:48 ` Moritz Bunkus
2012-11-17 22:56   ` Ray Andrews
2012-11-18  1:31     ` Bart Schaefer
2012-11-18  2:25       ` Ray Andrews

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).