Franz Fehringer dixit:

>I am using mksh on cygwin as delivered / installed by the cygwin setup.
>In this kind of configuration it is not possible to execute shell scripts 
>with CRLF line endings.

Yes, that is by design. mksh behaves consistently across platforms,
it does not cater to specifics of a specific platform unless these
are absolutely necessary.

You *really* should not write Unix shell scripts with CRLF. Cygwin
is a Unix environment. Use an editor such as jupp (also on mirbsd.org)
instead of Notepad to write them ;)

(In fact, I find that software on recent Windows systems, even as
old as 2009’s Windows Mobile 6.1, prefers LF line endings over CRLF.)

If you wish to have a variant of mksh that is adapted to the specifics
of the Win32 platform, there’s a beta version of a port of mksh R39
(old) to it. It behaves quite differently from mksh though, and it’s
used together with Win32 utilities (e.g. the Weihenstephan unxutils),
not with Cygwin, because Cygwin is “too unix-y” for it.

>Out of curiosity: Even with binary open mode it is possible to execute CRLF 
>shell scripts using option -c:
>mksh -c crlf.sh

The option -c does not run the script crlf.sh but instead simulates
you typing 'crlf.sh' and hitting Enter. That means it starts a $PATH
search for it, then asks the OS to execve() it. Only if that comes
back with a failure, mksh itself starts to inspect the file. (This
is exactly the same as “mksh -c cmd.exe”, which also works.) Your
script likely has a shebang Cygwin interprets.

bye,
//mirabilos
-- 
<diogenese> Beware of ritual lest you forget the meaning behind it.
<igli> yeah but it means if you really care about something, don't
    ritualise it, or you will lose it. don't fetishise it, don't
    obsess. or you'll forget why you love it in the first place.

Reply via email to