sudo make me a sandwich

xkcd 149 – punch this in your terminal:

cat > Makefile << _EOF
all: sandwich
`echo $'\t'`@touch me
`echo $'\t'`@if [ -e me ]; then rm me; touch a; fi
`echo $'\t'`@bash -c 'if [ -e a ]; then rm a; if [ \`whoami\` == "root" ] ; then echo "Ok"; else echo "Make it yourself"; fi; else echo "...?"; fi'

After that, try telling your command line to make you a sandwich, like this:

$ make me a sandwich
Make it yourself
$ sudo make me a sandwich
[sudo] password for ivucica:

corrected on August 11 2009, to adjust for differences in Ubuntu’s shell 🙂
corrected on September 24 2015, to explicitly specify use of /bin/bash and fix breakage on Debian Jessie


Leave a Reply

Your email address will not be published.


What is 11 + 2 ?
Please leave these two fields as-is:
IMPORTANT! To be able to proceed, you need to solve the following simple math (so we know that you are a human) :-)

This site uses Akismet to reduce spam. Learn how your comment data is processed.