zsh-users
 help / color / mirror / code / Atom feed
* set variable to output and immediately lowercase it?
@ 2012-10-16 22:42 TJ Luoma
  2012-10-16 23:05 ` Kurtis Rader
  2012-10-17  0:31 ` Geoff Wing
  0 siblings, 2 replies; 4+ messages in thread
From: TJ Luoma @ 2012-10-16 22:42 UTC (permalink / raw)
  To: Zsh-Users List

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


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

* Re: set variable to output and immediately lowercase it?
  2012-10-16 22:42 set variable to output and immediately lowercase it? TJ Luoma
@ 2012-10-16 23:05 ` Kurtis Rader
  2012-10-17  0:31 ` Geoff Wing
  1 sibling, 0 replies; 4+ messages in thread
From: Kurtis Rader @ 2012-10-16 23:05 UTC (permalink / raw)
  To: TJ Luoma; +Cc: Zsh-Users List

[-- Attachment #1: Type: text/plain, Size: 704 bytes --]

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@gmail.com> 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

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

* Re: set variable to output and immediately lowercase it?
  2012-10-16 22:42 set variable to output and immediately lowercase it? TJ Luoma
  2012-10-16 23:05 ` Kurtis Rader
@ 2012-10-17  0:31 ` Geoff Wing
  2012-10-17  2:28   ` TJ Luoma
  1 sibling, 1 reply; 4+ messages in thread
From: Geoff Wing @ 2012-10-17  0:31 UTC (permalink / raw)
  To: Zsh-Users List

On Tuesday 2012-10-16 18:42 -0400, TJ Luoma output:
:Is there a (reasonably sane) way to combine these into one line:
:	FOO=$(echo HeLlo WoRlD)
:	FOO="${FOO:l}"
: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.

Try small `l' parameter modifier
	FOO=${$(echo HeLlo WoRlD):l}
or capital `L' parameter expansion flag
	FOO=${(L)$(echo HeLlo WoRlD)}

Regards,
Geoff


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

* Re: set variable to output and immediately lowercase it?
  2012-10-17  0:31 ` Geoff Wing
@ 2012-10-17  2:28   ` TJ Luoma
  0 siblings, 0 replies; 4+ messages in thread
From: TJ Luoma @ 2012-10-17  2:28 UTC (permalink / raw)
  To: Zsh-Users List

Many thanks!

I hope that someday I feel like more than a 'slightly advanced novice'
at zsh :-)

TjL


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

end of thread, other threads:[~2012-10-17  2:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-16 22:42 set variable to output and immediately lowercase it? TJ Luoma
2012-10-16 23:05 ` Kurtis Rader
2012-10-17  0:31 ` Geoff Wing
2012-10-17  2:28   ` TJ Luoma

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