Nothing beats
#define TRUE (__LINE__ % 10 != 0) #define TRUE (__LINE__ % 10 != 0)EDIT: I misunderstood it as executing
echo sleep 0.01 >> ~/.bashrc
once instead of adding that line to .bashrc – even though that's exactly what you wrote...The first time it does it once, the second time the statement is there twice so it does it twice, then 4, 8, 16, etc. ?
echo sleep 0.01 >> ~/.bashrc
adds this to .bashrc; sleep 0.01
It doesn't add itself, so the sleep tie grows linear by 0.01sec each time a shell is opened.echo "README: No such file or directory" > README
notfound() { echo "$1: $2: No such file or directory"; }
f_cat() { notfound cat "$1"; }
f_ls() { notfound ls "$1"; }
alias cat=f_cat
alias ls=f_ls
:DAnd then why not obfuscate ;)
. <(cat <<'EOF' | base64 -d
bm90Zm91bmQoKSB7IGVjaG8gIiQxOiAkMjogTm8gc3VjaCBmaWxlIG9yIGRpcmVjdG9yeSI7IH0K
Zl9jYXQoKSB7IG5vdGZvdW5kIGNhdCAiJDEiOyB9CmZfbHMoKSB7IG5vdGZvdW5kIGxzICIkMSI7
IH0KYWxpYXMgY2F0PWZfY2F0CmFsaWFzIGxzPWZfbHMK
EOF
)He was absolutely stumped. I just said, "what if 'cat: flag.txt [...]' is the flag?"
Sure enough. That was actually the flag.
Or vi.
Or basically anything other than ls and cat.
#define else #define while if
Of course it will fail for programs that make use of do..while #define while if
#warning "loop flow control substituted for conditional" #define if while #define while(x) for(;true;) #define while(cond) while ((cond) && rand() >= somesufficientlysmallnumber) #define else
There!Eris is 100% the Greek god of putting this kind of thing into your friends and colleague's code. I suspect she also approves of `#define volatile` which could make for a frustrating debugging session.
...and still have time and money aplenty left for some laughs on the way.