tag 21672 notabug thanks On 10/12/2015 02:48 AM, Esli wrote: > Hello, > > > > env is not splitting command and argument as suggested by the synopsis: Thanks for the report. However, this is a misunderstanding on your part on how the kernel implements #! on your system, and has nothing to do with env. The same would happen for any other attempt you make on your system to write a shebang line with more than one set of space separations. In short, shebangs differ tremendously across systems in how they behave, and so the common subset that you can portably rely on is severely limited in what it can do. > #!/usr/bin/env perl -w > > produces: > > /usr/bin/env: perl -w: No such file or directory That's because on your system, #! magic supports exactly ONE argument, whitespace included, and does NOT break it into words in the same way the shell does. So your kernel is invoking '/usr/bin/env' 'perl -w', and env is blindly trying to execute 'perl -w' (which does not exist), exactly as requested. But it is not env's job to do word splitting. You cannot mix /usr/bin/env PROG and options to PROG in the same #! shebang. It is not portable. But it is a limitation of your system, and not something env can work around. If you were to use '#!/path/to/perl -w', then your kernel would attempt to invoke '/path/to/perl' '-w'. The trick for this is then determining at installation time what to place in the file for /path/to/perl, since there is no canonical location for perl across all systems. Also, the perl documentation includes some hints on how to use /usr/bin/env perl as the shebang line, and then, separate from that line, enable options that you can't portably include in the shebang. But as this is not the perl mailing list, and I'm not the expert in it, I'm not going to go trying to find that documentation right now. Therefore, I'm closing this as not a coreutils bug, although you should feel free to add further comments on the topic as desired. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org