From 18da240e8d5f5af1b1ecec604f09c89dd0deddab Mon Sep 17 00:00:00 2001 From: lohhiiccc <96543753+lohhiiccc@users.noreply.github.com> Date: Wed, 27 May 2026 00:24:10 +0200 Subject: [PATCH] fix: Colleen.sh --- src/Colleen.sh | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/src/Colleen.sh b/src/Colleen.sh index 9784794..0664be4 100644 --- a/src/Colleen.sh +++ b/src/Colleen.sh @@ -2,24 +2,32 @@ set -o posix -src=$'#!/usr/bin/env bash\n\nset -o posix\n\nsrc=$\'@\'\nfor (( i=0; i<${#src}; i++ )); do\n\tc=\"${src:i:1}\"\n\tascii=$(printf \'%d\' \"\'$c\")\n\n\tif [[ $ascii -eq 64 ]]; then\n\t\tfor (( j=0; j<${#src}; j++ )); do\n\t\t\tascii_j=$(printf \'%d\' \"\'${src:j:1}\")\n\t\t\tcase $ascii_j in\n\t\t\t\t92) echo -en \'\\\\\' ;;\n\t\t\t\t34) echo -en \'\\\\\"\' ;;\n\t\t\t\t39) echo -en \"\\\\\'\" ;;\n\t\t\t\t9) echo -en \'\\\\t\' ;;\n\t\t\t\t10) echo -en \'\\\\n\' ;;\n\t\t\t\t*) echo -en \"${src:j:1}\" ;;\n\t\t\tesac\n\t\tdone\n\telse\n\t\techo -en \"$c\"\n\tfi\ndone\n\n' +foo() +{ + echo 'Hello world!' >&2 +} + +src=$'#!/usr/bin/env bash\n\nset -o posix\n\nfoo()\n{\n\techo \'Hello world!\' >&2\n}\n\nsrc=$\'@\'\n# One of the comments must be present in the main function\noutput=\'\'\nfor (( i=0; i<${#src}; i++ )); do\n\tc="${src:i:1}"\n\n\tif [[ "$c" == $\'\\x40\' ]]; then\n\t\tfor (( j=0; j<${#src}; j++ )); do\n\t\t\tcase "${src:j:1}" in\n\t\t\t\t$\'\\\\\') output+=\'\\\\\' ;;\n\t\t\t\t$\'\\\'\') output+="\\\'" ;;\n\t\t\t\t$\'\\t\') output+=\'\\t\' ;;\n\t\t\t\t$\'\\n\') output+=\'\\n\' ;;\n\t\t\t\t*) output+="${src:j:1}" ;;\n\t\t\tesac\n\t\tdone\n\telse\n\t\toutput+="$c"\n\tfi\ndone\nprintf \'%s\' "$output"\n\nfoo\n# One of the comments must be present outside of your program.\n' +# One of the comments must be present in the main function +output='' for (( i=0; i<${#src}; i++ )); do c="${src:i:1}" - ascii=$(printf '%d' "'$c") - if [[ $ascii -eq 64 ]]; then + if [[ "$c" == $'\x40' ]]; then for (( j=0; j<${#src}; j++ )); do - ascii_j=$(printf '%d' "'${src:j:1}") - case $ascii_j in - 34) echo -en '\\"' ;; - 39) echo -en "\\'" ;; - 9) echo -en '\\t' ;; - 10) echo -en '\\n' ;; - *) echo -en "${src:j:1}" ;; + case "${src:j:1}" in + $'\\') output+='\\' ;; + $'\'') output+="\'" ;; + $'\t') output+='\t' ;; + $'\n') output+='\n' ;; + *) output+="${src:j:1}" ;; esac done else - echo -en "$c" + output+="$c" fi done +printf '%s' "$output" +foo +# One of the comments must be present outside of your program.