sed for shebang fails on OSX
jasonkeene opened this issue · 11 comments
The sed command that removes/replaces the shebang appears to fail on OSX yosemite:
$ c << EOF
#include <stdio.h>
int main()
{
printf("Hello World!\n");
return 0;
}
EOF
sed: 1: "/tmp/c.ox3.stdin.c": command c expects \ followed by text
Hello World!
sed: 1: "/tmp/c.ox3.stdin.c": command c expects \ followed by text
Using GNU sed
will fix the issue temporarily for you until this issue is resolved. brew install --with-default-names gnu-sed
and then try running it again. It seems that without gsed
, the shebang feature may not work, although invoking c
manually will still work, albeit with error messages.
@jasonkeene Try it now please.
I have completely removed the use of sed
. See if it works now.
@ryanmjacobs Could you tag HEAD as v0.09
please, Homebrew only accepts formulas that points to tagged releases.
Forgot to mention, but I have tested the current HEAD
and it works great!
@ryanmjacobs For shebang, actually I hope you can mention using zsh suffix alias, e.g., alias -s c="c"
, alias -s cpp="c"
, alias -s cc="c"
. By using this feature, there is no need for a shebang with chmod +x
(and that breaks regular compilation, right?), simply ./hello.c
is enough.
@hongxuchen Yes, but not everyone uses zsh. I'll try to mention it in the readme.
@ryanmjacobs Yes. And thanks for such a good wrapper.
@hongxuchen However, using this method you can't use compiler flags. Correct?
@ryanmjacobs Yes. So I think perhaps using CFLAGS
/CXXFLAGS
is a must.
I closing this issue because we have dropped the use of sed. This shouldn't be a problem anymore.