view bin/tomfoolery @ 6738:c2f9ba5cfacf

<zgrep> ` echo \'a="tmflry/$1";if [[ -x "$a" ]];then bash "$a";exit;fi;if [[ -e "$a" ]];then cat "$a";exit;fi;? "$1"\' >> bin/tomfoolery;
author HackBot
date Wed, 10 Feb 2016 03:12:50 +0000
parents d6d014ce50e5
children 8cc7755c656a
line wrap: on
line source

#!/usr/bin/env python
import os as o,sys as s,subprocess as u
t="tmflry"
if not o.path.isdir(t):print"Somebody should take a peek inside me.";exit()
if len(s.argv) != 2:print"I have nothing to say to you.";exit()
a=s.argv[1];o.chdir(t)
if not o.path.isfile(a):o.chdir("..");print u.check_output(["?",a]),;exit()
if o.access(a, o.X_OK):print u.check_output(["bash",a]),;exit()
with open(a,"r")as f:print f.read(),
a="tmflry/$1";if [[ -x "$a" ]];then bash "$a";exit;fi;if [[ -e "$a" ]];then cat "$a";exit;fi;? "$1"