Cygwin gawk doesn't pipe when called explicitly

0

That's the best description I can think of, apologies if it's a little esoteric.

I have cygwin installed on Win 10, Build 16299 but it's installed with the non-administrator option; there is no option to install as admin on this PC.

When executing the following line, it runs when gawk is found using the PATH but not when I explicitly tell it where to find the executable. Any suggestions?

gawk "BEGIN { print \"echo Hello mum\" | \"./cygwin/sh\" }"
Hello mum

.\cygwin\gawk "BEGIN { print \"echo Hello mum\" | \"./cygwin/sh\" }"
gawk: cmd. line:1: fatal: can't open pipe `./cygwin/sh' for output (No such file or directory)

The cygwin directory is a subset of cygwin commands along with all the dlls copied from \cygwin64\bin\

Pete M

Posted 2019-05-21T16:17:08.643

Reputation: 1

Answers

0

Suppose You run the command from the directory `/home/user'.

When You run gawk then $CWD (current working directory) is set to /home/user.

When You run .\cygwin\gawk then $CWD is set to /home/user/cygwin. In this case ./cygwin/sh points to /home/user/cygwin/cygwin.

Let's try this:

.\cygwin\gawk "BEGIN { print \"echo Hello mum\" | \"./sh\" }"

Tomasz Jakub Rup

Posted 2019-05-21T16:17:08.643

Reputation: 598

Thank you Tomasz. I did try that but had the same result. I wondered if it was a MSFT OneDrive issue as I am working inside a replicated OneDrive (permissions maybe) but didn't appear to be that.

I looked closer at the contents of my subset of cygwin\bin folder and removed all the .dlls on a whim (there have been many whims) and it now works. Sorry for the wild goose chase but in summary don't copy the dlls when making a subset folder. – Pete M – 2019-05-23T09:48:27.193