Skip to content

Instantly share code, notes, and snippets.

@jamesliu96
Created March 10, 2014 06:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamesliu96/9460400 to your computer and use it in GitHub Desktop.
Save jamesliu96/9460400 to your computer and use it in GitHub Desktop.
A simple Shell script output my name by compiling the BrainFuck script as C source code
#!/bin/sh
echo '>++++++++[<+++++++++>-]<++.>++++[<++++++>-]<-.++++++++++++.--------.++++++++++++++.>+++++++++[<--------->-]<--.>++++++[<+++++++>-]<++.>+++++[<++++++>-]<-.++++++++++++.>++++++++++[<----------->-]<+++.' | sed '
s/\([-+]\)/\1\1*p;/g
s/</p--;/g
s/>/p++;/g
s/>/p++;/g
s/\./putchar(*p);/g
s/\[/while(*p){/g
s/\]/}/g
1s/^/main(){char*p=calloc(1,6);/
$s/$/}/
/./!d'|gcc -xc - 2>/dev/null&&./a.out&&rm -f a.out
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment