<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Oct 26, 2013 at 6:53 AM, Johnny Rosenberg <span dir="ltr"><<a href="mailto:gurus.knugum@gmail.com" target="_blank">gurus.knugum@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div>x="hello"</div><div>echo ${x} → hello</div><div>echo ${x^} → Hello</div>
<div>echo ${x^^} → HELLO</div><div><br></div><div>So far, so good.</div><div><br></div><div>x="HELLO"</div>
<div>echo ${x} → HELLO</div><div>echo ${x,} → hELLO</div><div>echo ${x,,} → hello</div><div><br></div><div>Still good.</div><div><br></div><div>echo ${x^} → HELLO</div><div>echo ${x^,} → HELLO</div><div><br></div><div>Question: How to do ”HELLO” → ”Hello” in one step?</div>

<div><br></div><div>I can do it in two steps, of course:</div><div>y=${x,,}; echo ${y^} → Hello</div><span class=""><font color="#888888"><div><br></div><div><br></div><div>Johnny Rosenberg</div></font></span></div><br></blockquote>
<div><br></div><div>It doesn't look like you can use ${} inside another ${} with bash.<br><br></div><div>I found these alternatives :<br><br>s="HELLO"<br>echo $s | sed 's/.*/\L&/; s/[a-z]*/\u&/g'<br>
</div><div>Hello<br><br></div><div>or use zsh.<br><br></div><div>s="HELLO"<br></div><div>echo ${(C)${(L)s}}<br></div><div>Hello<br><br></div><div>s="THIS IS A TEST"<br></div><div>echo ${(C)${(L)s}}<br>
This Is A Test<br><br>-wes<br></div></div></div></div>