61 lines
983 B
Bash
Executable File
61 lines
983 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
string="Hallo Welt!"
|
|
|
|
echo ""
|
|
echo "string: $string"
|
|
echo ""
|
|
|
|
|
|
# - Bash 4
|
|
# -
|
|
echo "______"
|
|
echo "Bash 4"
|
|
echo " \${string^^}"
|
|
echo ""
|
|
echo "string: ${string^^}"
|
|
echo ""
|
|
|
|
|
|
# - tr
|
|
# -
|
|
echo "______"
|
|
echo "tr"
|
|
echo " echo \"\$string\" | tr '[:lower:]' '[:upper:]'"
|
|
echo ""
|
|
echo "string: $(echo "$string" | tr '[:lower:]' '[:upper:]')"
|
|
echo ""
|
|
|
|
|
|
# - awk
|
|
# -
|
|
echo "______"
|
|
echo "awk"
|
|
echo " echo \"\$string\" | awk '{print toupper(\$0)}'"
|
|
echo ""
|
|
echo "string: $(echo "$string" | awk '{print toupper($0)}')"
|
|
echo ""
|
|
|
|
|
|
# - sed
|
|
# -
|
|
echo "______"
|
|
echo "sed"
|
|
echo " echo \"\$string\" | sed -e 's/\(.*\)/\U\1/'"
|
|
echo ""
|
|
echo " sed -e 's/\(.*\)/\U\1/' <<< \"\$string\""
|
|
echo ""
|
|
echo "string: $(echo "$string" | sed -e 's/\(.*\)/\U\1/')"
|
|
echo "string: $(sed -e 's/\(.*\)/\U\1/' <<< "$string")"
|
|
echo ""
|
|
|
|
|
|
# - Perl
|
|
# -
|
|
echo "______"
|
|
echo "Perl"
|
|
echo " echo \"\$string\" | perl -ne 'print uc'"
|
|
echo ""
|
|
echo "string: $(echo "$string" | perl -ne 'print uc')"
|
|
echo ""
|