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

Re: Lonely spacecowboy

On Tue, Mar 27, 2007 at 04:18:43PM -0400, Brian K. White wrote:
> >~$ echo foo | read
> >~$ echo $REPLY
> >foo
> This is latest freestanding (static binary not needing cygwin dll) version 
> of zsh for windows that I have been able to locate, which is quite old,
> $P$Gecho $VERSION

Will be 10 years old in a few months. How time flies... :)

> The way cygwin only works by having the cygwin dll installed in the os and 
> can't be delivered in a self-contained package with the file makes cygwin 
> unsuitable for me.

Well, at least some time ago (time flying as well), you only
needed one DLL file so could put that in the same directory as
the zsh binary or something like that.

Even now, I don't think you need any superuser priviledge to run
cygwined command (don't quote me on that). Latest version of
zsh works fine on cygwin.

> >>awk '{system("somecommand \""$0"\"")}' files.txt
> >
> >Then you'd run into more problems (possibly serious) if the
> >lines in files.txt contain any ", \, $, `...
> Well I quoted the string, we do already know it contains spaces.
> I suppose it wouldn't be that much harder to get it single-quoted instead 
> of double-quoted and then it's just up to command to continue handling the 
> string safely.

single quotes would still be a problem for a single quoted
string. You could then escape the single quotes withing awk. I
find that there's not portable way to do so though.

Another possibility is:

    echo 'exec <&3 3<&-'
    sed 's/./\\&/g; s/^/somecommand /' < files.txt
  } 3<&- | sh
} 3<&0

> Or you could add as much sanity checking to the awk script as seems 
> necessary.
> But I forgot all about xargs, that was nicer than this anyways.

The example I gave was using GNU's -d option. Standardly, you

sed 's/./\\&/g' | xargs -n1 cmd

But note that xargs is kind of a joke command, the SUSv3 page
about it is a quite a nice one in itself as well. POSIX allows
very low limitations, many implementations have enormous bugs.
It's generally safer to stay away from it except for the GNU/BSD
xargs -r0 in combination with some NUL aware commands.


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