Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Now that is cool!
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="V6Pony" data-source="post: 1419832" data-attributes="member: 177295"><p>#!/bin/bash</p><p>echo "Enter lower case text here"</p><p>read foo</p><p>var=`echo $foo | tr "{a-z}" "{A-Z}"`</p><p># {a-z} Matches a through z</p><p># {A-Z} matches A through Z</p><p>echo $var</p><p></p><p>but I'm not sure I fully understand ` ` I think it allows the output from an application to be stored in a variable. In this example the output from echo $foo | tr "{a-z}" "{A-Z}" is saved in var. So what does tr do? Change lower case to upper case. Why does it do that? </p><p></p><p> The tr utility copies the given input to produced the output with substitution or deletion of selected characters. tr abbreviated as translate or transliterate. It takes as parameters two sets of characters, and replaces occurrences of the characters in the first set with the corresponding elements from the other set i.e. it is used to translate characters.</p></blockquote><p></p>
[QUOTE="V6Pony, post: 1419832, member: 177295"] #!/bin/bash echo "Enter lower case text here" read foo var=`echo $foo | tr "{a-z}" "{A-Z}"` # {a-z} Matches a through z # {A-Z} matches A through Z echo $var but I'm not sure I fully understand ` ` I think it allows the output from an application to be stored in a variable. In this example the output from echo $foo | tr "{a-z}" "{A-Z}" is saved in var. So what does tr do? Change lower case to upper case. Why does it do that? The tr utility copies the given input to produced the output with substitution or deletion of selected characters. tr abbreviated as translate or transliterate. It takes as parameters two sets of characters, and replaces occurrences of the characters in the first set with the corresponding elements from the other set i.e. it is used to translate characters. [/QUOTE]
Verification
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Now that is cool!
Top