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

Re: set variable to output and immediately lowercase it?



typeset -l FOO="$(echo HeLlo WoRlD)"

or more typically

typeset -l FOO
FOO=$(echo HeLlo WoRlD)

On Tue, Oct 16, 2012 at 3:42 PM, TJ Luoma <luomat@xxxxxxxxx> wrote:

> Is there a (reasonably sane) way to combine these into one line:
>
>         FOO=$(echo HeLlo WoRlD)
>
>         FOO="${FOO:l}"
>
> I mean, I know I could do this:
>
>         FOO=$(echo HeLlo WoRlD | tr '[:upper:]' '[:lower:]')
>
> but I mean is it possible to do this all in zsh.
>
>
> I tried
>
>         FOO=$(echo HeLlo WoRlD):l
>
> and
>
>         FOO=($(echo HeLlo WoRlD):l)
>
> but they don't work, it just adds ":l" to the end of the variable.
>
> TjL
>



-- 
Kurtis Rader
Caretake of the exceptional canines Junior and Chino


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