Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Self-generating zsh script



In case anyone's bored on this Friday (afternoon, here), I thought I'd
try writing one of those scripts whose output is itself in zsh.  It
appears to be working:

------------------------
#!/usr/bin/env zsh

a='#!/usr/bin/env zsh\x0A\x0Aa=%s%s%s\x0A\x0Aprint -f $a \\\x27 $a \\\x27\x0A'

print -f $a \' $a \'
------------------------

The assignment line is not supposed to wrap.

Here's what I get when I compare the original script to the output of
the script, using the handy =() substitution.

   $ diff self.zsh =(zsh self.zsh)
   $ echo $?
   0

-- 
Chris Johnson
cjohnson@xxxxxxxxxx
http://www.cs.utk.edu/~cjohnson



Messages sorted by: Reverse Date, Date, Thread, Author