Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gawk installation location incorrect on MacOS #24

Open
tomjn opened this issue Dec 18, 2020 · 3 comments
Open

Gawk installation location incorrect on MacOS #24

tomjn opened this issue Dec 18, 2020 · 3 comments

Comments

@tomjn
Copy link
Contributor

tomjn commented Dec 18, 2020

Homebrew installs gawk to /usr/local/bin/gawk on MacOS, but the make file only works if it's installed to /usr/bin/gawk

@tomjn tomjn changed the title Gawk installation location Gawk installation location incorrect on MacOS Dec 18, 2020
@kovetskiy
Copy link
Member

I don't know how to fix it right now because there is a problem with portability in shebang:

https://www.wikiwand.com/en/Shebang_(Unix)#/Character_interpretation

So we can't use #!/usr/bin/env gawk -f instead.

I think Homebrew scripts should patch shdoc during the installation.

@tomjn
Copy link
Contributor Author

tomjn commented Dec 20, 2020

Oh I didn't use homebrew to install shdoc, I ran brew install gawk then followed the instructions to clone and sudo make install. Eitherway manually patching scripts in a package manager sounds like a recipe for disaster and technical debt.

Instead, a more portable solution might be to use a shell script e.g. something like this

#!/usr/bin/env sh

read -d '' scriptVariable << 'EOF'
BEGIN {
    print "start"
}
{
    print $0
}
END{
    print "hello"
}
EOF

gawk -f "$scriptVariable" ${inputfile}

This way the problem you mentioned is sidestepped completely

@mlsmrc
Copy link

mlsmrc commented May 22, 2021

#35
This works perfectly on my mac

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants