Andrew Kingston wrote:
I've just been doing a bit more digging & I think I've found what was
causing the problem. In \cygwin\bin if you do an ls -l awk.exe, it
gives you: lrwxrwxrwx 1 Adminst Users 19 Nov 1 2004 awk.exe -> gawk.exe.
Huh, I didn't know cygwin somehow implemented symbolic links
under Windows.
Maybe underneath it's a 'junction'.. Windows terminology
for a symlink, which Win32 does support, but junctions can
only be pointed to files on the same disk currently, not to
network drives :/
More info about NTFS junctions here:
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q205524
If I run gawk.exe at a DOS prompt I don't get any errors, but run
awk.exe, and I get the error I've been mentioning.
Weird.
It's as if the cygwin symbolic link is the cause.
I get the same error
whenever I try to run one of the linked Cygwin apps at a DOS prompt -
like gunzip.exe & zcat.exe.
If you're curious, it might be interesting to make it a copy
instead of a link, eg:
cp gawk.exe /temp/awk.exe
echo 4 | /temp/awk '{ printf("%04d\n"; }'
..the implication being if that works, it's the symlink for sure.
Might be a bug in the specific version of cygwin you're using.
I tried cygwin once, and it was too weird for me. It has too
many hoops it hops through with those weird pathnames it uses,
and some of its shells are kinda buggy. So I left it alone,
and decided to just do everything in perl, and just live with
DOS as an interactive shell. DOS has been getting better;
things like tab completion and better commands make it less
annoying than it used to be.
So it looks like I could put the code back
into my script if I needed to as long as I used gawk instead of awk.
Yes -- I'd agree.
It's good you got to the bottom of that; we can all know
to watch for this.
FWIW, within your perl script, you should be able to do
all awk-like stuff within perl, eg. these being equivalent:
echo 4 | awk '{ printf("%04d\n",$0); }'
echo 4 | perl -ne '{ printf("%04d\n",$_); }'
..or better yet, just use perl to do the work.
I can't think of any situation where one would
need a perl script to invoke awk externally.. it's
usually always more efficient to code it all within perl.
eg. I'd always prefer these perl commands:
my $padframe = sprintf("%04d", $frame);
..to these:
my $padframe = `echo $frame | awk '{ printf("%04d\n",$0); }'`;
chomp($padframe);
--
Greg Ercolano, erco@(email surpressed)
Rush Render Queue, http://seriss.com/rush/
Tel: (Tel# suppressed)
Cel: (Tel# suppressed)
Fax: (Tel# suppressed)
|