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 '[:upper:]' '[:lower:]'"
|
|
echo ""
|
|
echo "string: $(echo "$string" | tr '[:upper:]' '[:lower:]')"
|
|
echo ""
|
|
|
|
|
|
# - awk
|
|
# -
|
|
echo "______"
|
|
echo "awk"
|
|
echo " echo \"\$string\" | awk '{print tolower(\$0)}'"
|
|
echo ""
|
|
echo "string: $(echo "$string" | awk '{print tolower($0)}')"
|
|
echo ""
|
|
|
|
|
|
# - sed
|
|
# -
|
|
echo "______"
|
|
echo "sed"
|
|
echo " echo \"\$string\" | sed -e 's/\(.*\)/\L\1/'"
|
|
echo ""
|
|
echo " sed -e 's/\(.*\)/\L\1/' <<< \"\$string\""
|
|
echo ""
|
|
echo "string: $(echo "$string" | sed -e 's/\(.*\)/\L\1/')"
|
|
echo "string: $(sed -e 's/\(.*\)/\L\1/' <<< "$string")"
|
|
echo ""
|
|
|
|
|
|
# - Perl
|
|
# -
|
|
echo "______"
|
|
echo "Perl"
|
|
echo " echo \"\$string\" | perl -ne 'print lc'"
|
|
echo ""
|
|
echo "string: $(echo "$string" | perl -ne 'print lc')"
|
|
echo ""
|