fix: Colleen.sh

This commit is contained in:
lohhiiccc 2026-05-27 00:24:10 +02:00
parent 50a191d600
commit 18da240e8d

View file

@ -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.