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

Re: bash conversion trouble.



On Feb 24,  5:35pm, Ray Andrews wrote:
} Subject: bash conversion trouble.
}
} Gentlemen:
} 
} 
} I'm trying to convert a long script from bash, which I know not at all, 
} to zsh, which I know hardly better:
} 
} bash likes thisbut zsh throws a syntax error:
} 
}      case "${USE_OVERLAYFS,,}" in

       ${parameter^pattern}
       ${parameter^^pattern}
       ${parameter,pattern}
       ${parameter,,pattern}
              Case modification. This expansion modifies the case
              of alphabetic characters in parameter. The pattern
              is expanded to produce a pattern just as in pathname
              expansion. The ^ operator converts lowercase letters
              matching pattern to uppercase; the , operator converts
              matching uppercase letters to lowercase. The ^^ and ,,
              expansions convert each matched character in the expanded
              value; the ^ and , expansions match and convert only
              the first character in the expanded value. If pattern
              is omitted, it is treated like a ?, which matches every
              character. If parameter is @ or *, the case mod ification
              operation is applied to each positional parameter in turn,
              and the expansion is the resultant list. If parameter
              is an array variable sub scripted with @ or *, the case
              modification operation is applied to each member of the
              array in turn, and the expansion is the resultant list.

So bash ${name,,} is zsh ${(L)name} ... and there isn't a simple zsh
equivalent for what happens if there is a pattern following the ,,

It'd also be kind of ugly to add ${name^pat} to zsh at this point, as
we've already got ${name:^var} and ${name:^^var} which mean something
radically different.  (Not implementation-ugly, but semantics-ugly.)



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