Created
February 28, 2019 14:13
-
-
Save praetoriansentry/1ef5f4281183db797ef124ccc3a34feb to your computer and use it in GitHub Desktop.
My first quine written in bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Quine John Hilliard | |
prog=( | |
'#!/bin/bash' | |
'# Quine John Hilliard\n' | |
'prog=(' | |
')' | |
'q=$(printf "\x27")' | |
'for i in \`seq 0 2\`; do' | |
' echo -e "${prog[$i]}"' | |
'done' | |
'for i in \`seq 0 13\`; do' | |
' echo " $q${prog[$i]}$q"' | |
'done' | |
'for i in \`seq 3 13\`; do' | |
' echo "${prog[$i]}" | sed "s:\\\\\\`:\\\\`:g"' | |
'done' | |
) | |
q=$(printf "\x27") | |
for i in `seq 0 2`; do | |
echo -e "${prog[$i]}" | |
done | |
for i in `seq 0 13`; do | |
echo " $q${prog[$i]}$q" | |
done | |
for i in `seq 3 13`; do | |
echo "${prog[$i]}" | sed "s:\\\\\`:\\\`:g" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment