-
Notifications
You must be signed in to change notification settings - Fork 3
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
Can't run most basic commands due to CRLF: ls\r not found #4
Comments
@Endle Hello! You're doing it a bit wrong, I'm afraid. First, bash really doesn't like \r\n line endings. To work around that in Cygwin, you need to pass the
For an example, please see my test workflow at setup-cygwin/.github/workflows/test.yml Line 79 in d9b45e8
But you don't even need to do that, since Cygwin's /usr/bin (as well as /usr/local/bin) is added to the system PATH, so you can just call ls and pwd directly:
|
Thank you! Using the full configuration resolves my problem
I created a PR for those who may have similar doubts #5 |
Recent bash for cygwin C:\cygwin64\bin\bash.exe -o igncr
echo $SHELLOPTS
> braceexpand:emacs:hashall:histexpand:history:igncr:interactive-comments:monitor
bash
echo $SHELLOPTS
> braceexpand:emacs:hashall:histexpand:history:interactive-comments:monitor That's why any subscript fails, so If C:\cygwin64\bin\bash.exe -cl "env SHELLOPTS=igncr bash"
echo $SHELLOPTS
> braceexpand:emacs:hashall:histexpand:history:igncr:interactive-comments:monitor
bash
echo $SHELLOPTS
> braceexpand:emacs:hashall:histexpand:history:igncr:interactive-comments:monitor
run: C:\cygwin64\bin\bash.exe -cl "env SHELLOPTS=igncr '%cd%\scripts\some.sh'" Thank you. |
@andrew-aladev I don't think anything's broken; I just run the test workflow and it works fine with
AFAIR, SHELLOPTS has always been read-only; it's readonly on all my Linux machines. Quote from the manual (as read on Linux):
I think it's meant to be modified using Now, in your example, igncr works fine for the outer instance of bash. The inner instance of bash doesn't inherit SHELLOPTS, and it never does this not on Cygwin, nor on Linux. To make it inherit SHELLOPTS, you need to either put
Same from a Cygwin prompt:
Take a look at this question for reference: https://unix.stackexchange.com/q/387186 |
@andrew-aladev Please either don't use nested bash invocations (is there way around it? This issue was about a legitimate use-case concerning GitHub Actions.), or put something like |
Hello @egor-tensin, your test script doesn't include subscripts, so it won't fail. You can include any subscript and it will fail.
This is just design limitation made by
Real world application uses high degree of inheritance, why not? This is just Please consider adding some sort of |
Yes, if the "sub" script has \r\n as line terminators. In which case any Linux bash will choke on it too (I think it's stupid BTW). bash scripts run on Cygwin also tend to be run on real Linux machines quite often, so scripts writers should make sure \n is used as line terminator in their scripts (I do this using .gitattributes).
I will, thanks. |
Done |
Proof of concept:
I have such error:
The text was updated successfully, but these errors were encountered: