Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Self-generating zsh script
- X-seq: zsh-users 10908
- From: Chris Johnson <cjohnson@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Self-generating zsh script
- Date: Fri, 27 Oct 2006 13:28:53 -0400
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
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