Y'all, I created an #ed(1) monster:
!echo "HELLO" > hello.txt
E hello.txt
p
s/.*/p\
s|.*|p\\\
s;.*;p\\\\\\\
Q\\\\\\\
;\\\
,w !ed %\\\
Q\\\
|\
,w !ed %\
Q\
/
,w !ed %
Q
It's a script that
- Prints contents of a file, then
- Rewrites them to a script that
- Prints contents of a file, and then
- Rewrites them to a scripts that
- Prints contents of a file, and then
- Rewrites them to a script that
- Prints the contents of a file
- And then exits.
And who said that metaprogramming is not possible outside #Lisp? (No one, actually.)