generated from loic/c-template
feat: broken colleen in bash
This commit is contained in:
parent
dbdf78778c
commit
50a191d600
1 changed files with 25 additions and 0 deletions
25
src/Colleen.sh
Normal file
25
src/Colleen.sh
Normal file
|
|
@ -0,0 +1,25 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
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'
|
||||||
|
for (( i=0; i<${#src}; i++ )); do
|
||||||
|
c="${src:i:1}"
|
||||||
|
ascii=$(printf '%d' "'$c")
|
||||||
|
|
||||||
|
if [[ $ascii -eq 64 ]]; 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}" ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
else
|
||||||
|
echo -en "$c"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
Loading…
Add table
Reference in a new issue