Initial commit

This commit is contained in:
2018-04-30 02:53:44 +02:00
commit f39b0fbcd8
26 changed files with 1755 additions and 0 deletions

60
snippets/tolower.sh Executable file
View File

@@ -0,0 +1,60 @@
#!/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 ""