Skip to main content
added 7 characters in body
Source Link
Martin Ender
  • 197.2k
  • 67
  • 447
  • 975

Shell echo-sed quine:

echo sed -eh -es/[\\\(\\\\\\\\\\\)\\\&\\\|]/\\\\\\\\\\\&/g -es/^/echo\\ / -es/$/\\\|/ -eG| sed -eh -es/[\(\\\\\)\&\|]/\\\\\&/g -es/^/echo\ / -es/$/\|/ -eG

echo sed -eh -es/[\\\(\\\\\\\\\\\)\\\&\\\|]/\\\\\\\\\\\&/g -es/^/echo\\ / -es/$/\\\|/ -eG|
sed -eh -es/[\(\\\\\)\&\|]/\\\\\&/g -es/^/echo\ / -es/$/\|/ -eG

I wanted to write a sed quine, but sed can only work on its input stream, not generate output spontaneously, so this is an echo-sed quine. This 154-character quine uses command-line sed, which automatically makes it hard to read, and uses three different sed commands, as well as two sequences of eleven backslashes in a row. This quine works in bash, ksh, and sh, but not csh or tcsh.

EDIT:

A blatant, and amusing, cheat: echo $BASH_COMMAND

Another, unreasonably silly, cheat: export PROMPT_COMMAND='echo $BASH_COMMAND';$PROMPT_COMMAND

Shell echo-sed quine:

echo sed -eh -es/[\\\(\\\\\\\\\\\)\\\&\\\|]/\\\\\\\\\\\&/g -es/^/echo\\ / -es/$/\\\|/ -eG| sed -eh -es/[\(\\\\\)\&\|]/\\\\\&/g -es/^/echo\ / -es/$/\|/ -eG

I wanted to write a sed quine, but sed can only work on its input stream, not generate output spontaneously, so this is an echo-sed quine. This 154-character quine uses command-line sed, which automatically makes it hard to read, and uses three different sed commands, as well as two sequences of eleven backslashes in a row. This quine works in bash, ksh, and sh, but not csh or tcsh.

EDIT:

A blatant, and amusing, cheat: echo $BASH_COMMAND

Another, unreasonably silly, cheat: export PROMPT_COMMAND='echo $BASH_COMMAND';$PROMPT_COMMAND

Shell echo-sed quine:

echo sed -eh -es/[\\\(\\\\\\\\\\\)\\\&\\\|]/\\\\\\\\\\\&/g -es/^/echo\\ / -es/$/\\\|/ -eG|
sed -eh -es/[\(\\\\\)\&\|]/\\\\\&/g -es/^/echo\ / -es/$/\|/ -eG

I wanted to write a sed quine, but sed can only work on its input stream, not generate output spontaneously, so this is an echo-sed quine. This 154-character quine uses command-line sed, which automatically makes it hard to read, and uses three different sed commands, as well as two sequences of eleven backslashes in a row. This quine works in bash, ksh, and sh, but not csh or tcsh.

EDIT:

A blatant, and amusing, cheat: echo $BASH_COMMAND

Another, unreasonably silly, cheat: export PROMPT_COMMAND='echo $BASH_COMMAND';$PROMPT_COMMAND

added 126 characters in body
Source Link
Andrew
  • 91
  • 1
  • 2

Shell echo-sed quine:

echo sed -eh -es/[\\\(\\\\\\\\\\\)\\\&\\\|]/\\\\\\\\\\\&/g -es/^/echo\\ / -es/$/\\\|/ -eG| sed -eh -es/[\(\\\\\)\&\|]/\\\\\&/g -es/^/echo\ / -es/$/\|/ -eG

I wanted to write a sed quine, but sed can only work on its input stream, not generate output spontaneously, so this is an echo-sed quine. This 154-character quine uses command-line sed, which automatically makes it hard to read, and uses three different sed commands for a perhaps inefficient quine. However, it makes use ofas well as two sequences of eleven backslashes in a row. This quine works in bash, ksh, and sh, but not csh or tcsh.

EDIT:

A blatant, and amusing, cheat: echo $BASH_COMMAND

Another, unreasonably silly, cheat: export PROMPT_COMMAND='echo $BASH_COMMAND';$PROMPT_COMMAND

Shell echo-sed quine:

echo sed -eh -es/[\\\(\\\\\\\\\\\)\\\&\\\|]/\\\\\\\\\\\&/g -es/^/echo\\ / -es/$/\\\|/ -eG| sed -eh -es/[\(\\\\\)\&\|]/\\\\\&/g -es/^/echo\ / -es/$/\|/ -eG

I wanted to write a sed quine, but sed can only work on its input stream, not generate output spontaneously, so this is an echo-sed quine. This 154-character quine uses command-line sed, which automatically makes it hard to read, and uses three different sed commands for a perhaps inefficient quine. However, it makes use of two sequences of eleven backslashes in a row. This quine works in bash, ksh, sh, but not csh or tcsh.

Shell echo-sed quine:

echo sed -eh -es/[\\\(\\\\\\\\\\\)\\\&\\\|]/\\\\\\\\\\\&/g -es/^/echo\\ / -es/$/\\\|/ -eG| sed -eh -es/[\(\\\\\)\&\|]/\\\\\&/g -es/^/echo\ / -es/$/\|/ -eG

I wanted to write a sed quine, but sed can only work on its input stream, not generate output spontaneously, so this is an echo-sed quine. This 154-character quine uses command-line sed, which automatically makes it hard to read, and uses three different sed commands, as well as two sequences of eleven backslashes in a row. This quine works in bash, ksh, and sh, but not csh or tcsh.

EDIT:

A blatant, and amusing, cheat: echo $BASH_COMMAND

Another, unreasonably silly, cheat: export PROMPT_COMMAND='echo $BASH_COMMAND';$PROMPT_COMMAND

Source Link
Andrew
  • 91
  • 1
  • 2

Shell echo-sed quine:

echo sed -eh -es/[\\\(\\\\\\\\\\\)\\\&\\\|]/\\\\\\\\\\\&/g -es/^/echo\\ / -es/$/\\\|/ -eG| sed -eh -es/[\(\\\\\)\&\|]/\\\\\&/g -es/^/echo\ / -es/$/\|/ -eG

I wanted to write a sed quine, but sed can only work on its input stream, not generate output spontaneously, so this is an echo-sed quine. This 154-character quine uses command-line sed, which automatically makes it hard to read, and uses three different sed commands for a perhaps inefficient quine. However, it makes use of two sequences of eleven backslashes in a row. This quine works in bash, ksh, sh, but not csh or tcsh.