view paste/paste.18999 @ 2317:32451419357a

<Jafet> (echo \'#!/bin/sh\'; echo \'a() { p=$(echo -n $(ps -p $0 -oppid | tail -1)); if egrep " \\| cat\\$" /proc/$p/cmdline; then ps -p $0 -ocmd | tail -1; else a $p; fi }\'; echo \'a $$\') > bin/quine2
author HackBot
date Fri, 01 Mar 2013 02:00:55 +0000
parents ab2c49f31e97
children
line wrap: on
line source

#!/bin/sh
cd /var/irclogs/_esoteric
if [ "$1" ]; then
    grep -P -i -- "$1" ????-??-??.txt | shuf -n 1
else
    file=$(shuf -en 1 ????-??-??.txt)
    echo "$file:$(shuf -n 1 $file)"
fi