Mercurial > repo
changeset 2320:da776ff681e5
<Jafet> (echo \'#!/bin/sh\'; echo \'a() { p=$(echo -n $(ps -p $1 -oppid | tail -1)); if ps -p $p -ocmd | tail -1 | egrep " \\| cat\\$"; then ps -p $1 -ocmd | tail -1; else a $p; fi }\'; echo \'a $$\') > bin/quine2 && quine2 a b c
author | HackBot |
---|---|
date | Fri, 01 Mar 2013 02:07:19 +0000 |
parents | 234b02097c66 |
children | da361e77bd10 |
files | bin/quine2 |
diffstat | 1 files changed, 1 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/quine2 Fri Mar 01 02:03:43 2013 +0000 +++ b/bin/quine2 Fri Mar 01 02:07:19 2013 +0000 @@ -1,3 +1,3 @@ #!/bin/sh -a() { cat /proc/$1/cmdline; p=$(echo -n $(ps -p $1 -oppid | tail -1)); if egrep " \| cat\$" /proc/$p/cmdline; then ps -p $1 -ocmd | tail -1; else a $p; fi } +a() { p=$(echo -n $(ps -p $1 -oppid | tail -1)); if ps -p $p -ocmd | tail -1 | egrep " \| cat\$"; then ps -p $1 -ocmd | tail -1; else a $p; fi } a $$