in reply to Re: CR/LF in bin
in thread CR/LF in bin

Did you try either of your proposed solutions?

$ cd /tmp/perlmonks/ $ echo -e '#!/usr/bin/env perl \r\nprint "Foo!\\n";' > foo.pl $ chmod 0755 foo.pl $ ./foo.pl /usr/bin/env: ‘perl \r’: No such file or directory /usr/bin/env: use -[v]S to pass options in shebang lines $ echo -e '#!/usr/bin/env perl -w\r\nprint "Foo!\\n";' > foo.pl $ ./foo.pl /usr/bin/env: ‘perl -w\r’: No such file or directory /usr/bin/env: use -[v]S to pass options in shebang lines $

The correct solution is use -S on the env command:

$ echo -e '#!/usr/bin/env -S perl\r\nprint "Foo!\\n";' > foo.pl $ ./foo.pl Foo! $

🦛

Replies are listed 'Best First'.
Re^3: CR/LF in bin
by dk (Chaplain) on May 09, 2024 at 17:43 UTC
    Interesting but doesn't seem to work on my ubuntu:

    $ echo -e '#!/usr/bin/env -S perl\r\nprint "Foo!\\n";' > foo.pl
    $ chmod 755 foo.pl
    $ ./foo.pl
    /usr/bin/env: ‘perl\r’: No such file or directory

      Which version of env are you running? I have:

      env (GNU coreutils) 9.5 Copyright (C) 2024 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/g +pl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Written by Richard Mlynarik, David MacKenzie, and Assaf Gordon.

      🦛

        env (GNU coreutils) 8.32
A reply falls below the community's threshold of quality. You may see it by logging in.