in reply to CR/LF in bin

This node falls below the community's threshold of quality. You may see it by logging in.

Replies are listed 'Best First'.
Re^2: CR/LF in bin
by hippo (Archbishop) on May 09, 2024 at 17:32 UTC

    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! $

    🦛

      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.

        🦛

    A reply falls below the community's threshold of quality. You may see it by logging in.