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/toupper.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 '[: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 ""