Mercurial > repo
changeset 2321:da361e77bd10
<Jafet> (echo \'#!/bin/sh\'; echo \'a() { p=$(echo -n $(ps -p $1 -oppid | tail -1)); if ps -p $p -ocmd | tail -1 | egrep -q " \\| cat\\$"; then ps -p $1 -ocmd | tail -1; else a $p; fi }\'; echo \'q=$(a $$); if echo "$q" | grep -q "^bash -c"; then echo "$q" | sed "s/^bash -c/`run/"; elif echo "$q" | grep -q "^/bin/sh"; then echo "$q" | sed "s,^/bin/sh,`,"; else echo \\`"$q"; fi\') > bin/quine2
author | HackBot |
---|---|
date | Fri, 01 Mar 2013 02:13:13 +0000 |
parents | da776ff681e5 |
children | db759ee5bcf5 |
files | bin/quine2 |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/bin/quine2 Fri Mar 01 02:07:19 2013 +0000 +++ b/bin/quine2 Fri Mar 01 02:13:13 2013 +0000 @@ -1,3 +1,3 @@ #!/bin/sh -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 $$ +a() { p=$(echo -n $(ps -p $1 -oppid | tail -1)); if ps -p $p -ocmd | tail -1 | egrep -q " \| cat\$"; then ps -p $1 -ocmd | tail -1; else a $p; fi } +q=$(a $$); if echo "$q" | grep -q "^bash -c"; then echo "$q" | sed "s/^bash -c/`run/"; elif echo "$q" | grep -q "^/bin/sh"; then echo "$q" | sed "s,^/bin/sh,`,"; else echo \`"$q"; fi