Bash-Anleitung: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
K (cat) |
(tr...) |
||
Zeile 1: | Zeile 1: | ||
Eine tolle Einführung gibt's unter http://www.linuxfibel.de/bash.htm | Eine tolle Einführung gibt's unter http://www.linuxfibel.de/bash.htm | ||
=How to convert a string to upper or lower case in bash?= | |||
from http://blog.spikesource.com/bashstringconversion.htm | |||
Assuming tr is available on the system, | |||
Convert the given argument into an all lower case string. | |||
toLower() { | |||
echo $1 | tr "[:upper:]" "[:lower:]" | |||
} | |||
Convert the given argument into an all lower case string. | |||
toUpper() { | |||
echo $1 | tr "[:lower:]" "[:upper:]" | |||
keywords: sh,bash,linux,console,cmd,command,shell | keywords: sh,bash,linux,console,cmd,command,shell | ||
[[Category:Linux]] | [[Category:Linux]][[Category:Tips_und_Tricks]] |
Version vom 18. Januar 2007, 21:47 Uhr
Eine tolle Einführung gibt's unter http://www.linuxfibel.de/bash.htm
How to convert a string to upper or lower case in bash?
from http://blog.spikesource.com/bashstringconversion.htm
Assuming tr is available on the system,
Convert the given argument into an all lower case string.
toLower() { echo $1 | tr "[:upper:]" "[:lower:]" }
Convert the given argument into an all lower case string.
toUpper() { echo $1 | tr "[:lower:]" "[:upper:]"
keywords: sh,bash,linux,console,cmd,command,shell