help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] Case modification


From: Bill Gradwohl
Subject: [Help-bash] Case modification
Date: Fri, 23 Dec 2011 12:12:12 -0600

I've read man bash on this and did some experimentation. I'm confused about how to interpret what "pattern" means. Does it take each character in pattern as a discrete item or does pattern get looked at as a whole.

address@hidden ~# x="hello there"; echo ${x^he}
hello there
Why aren't the first 2 characters upper cased?

address@hidden ~# x="hello there"; echo ${x^^he}
hello there
Why isn't every occurrence of 'he' upper cased?


address@hidden ~# x="hello there"; echo ${x^[he]}
Hello there
address@hidden ~# x="hello there"; echo ${x^^[he]}
HEllo tHErE
This would seem to indicate that 'h' is a pattern and 'e' is a pattern and that 'he' is not a pattern.


address@hidden ~# x="hello there"; echo ${x^^{#?, ?}}
hello there}
Complete mystery!

The reason I'm interested in this is to see if it's possible to write a statement to capitalize the first letter of every word - produce 'Hello There'.

--
Bill Gradwohl


reply via email to

[Prev in Thread] Current Thread [Next in Thread]