From d047373d874576c0166fbaeae260474304d5dcd5 Mon Sep 17 00:00:00 2001 From: michael Date: Wed, 26 Jul 2023 09:38:44 -0400 Subject: [PATCH] aDdEd mY sponGe SCRiPT lOL --- bash/sponge | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 bash/sponge diff --git a/bash/sponge b/bash/sponge new file mode 100755 index 0000000..615853a --- /dev/null +++ b/bash/sponge @@ -0,0 +1,18 @@ +#!/bin/bash + +echo -e "\nspongifying $@...\n\n" + +str="$@" +lstr="${str,,}" +ustr="${str^^}" + +# https://stackoverflow.com/a/10552175 +for (( c=0; c<${#str}; c++ )); do + # https://stackoverflow.com/a/1195035 + if [[ $((1 + $RANDOM % 10)) < 5 ]]; then + echo -n "${lstr:$c:1}" + else + echo -n "${ustr:$c:1}" + fi +done +echo; echo