Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: array matching: inconsistent behaviour ?



On Wed, Jan 9, 2013 at 3:10 PM, Peter Stephenson

> You're not exactly doing anything wrong, but quoting here has alwas been
> a bit funny to allow (some forms of) pattern matching.  To ensure an
> exact string match you can use the (e) flag...
>
> % print $FOO[(ie)$x]
> 1
> % print $FOO[(ie)$y]
> 2
>
> pws
>

My apologies. There's just so much zsh provides, it's difficult for a
newcomer to keep it all in the head even though I have printouts next to
me. You've done an awesome job with zsh!

I've been using the "print -rC" to print in columns -- saves me from quite
a bit of programming. However, often the data has spaces in it, or tabs. Of
course, print will wrap/break on those. So i found a hack to use "tr" to
replace spaces and tabs with ^a and ^b before feeding to "print" and then
doing the reverse after "print" gives the output. However, putting the
spaces back after "print" has done its formatting means that the alignment
is disturbed by the spaces.

I tried to change the IFS to newlines before calling print, but it seems
"print" does not use IFS to wrap/split lines into columns. Is there some
direct way to prevent "print -rC" from wrapping on spaces and tabs.

-- 
 rahul


Messages sorted by: Reverse Date, Date, Thread, Author