Aug 11, 2011

Differences between linux and Solaris /usr/bin/env


I’ve a simple script:

#!/usr/bin/env perl -w
print "Hello Worldn"

Make this executable, run on Linux, and I get:

/usr/bin/env: perl -w: No such file or directory

(without the -w, this works OK)

Running the same script on a Solaris 8 machine produces the correct output.

Any suggestions as to why this is ?


It’s not env; it’s the kernel’s #! handler. Everything after the first word (/usr/bin/env) is passed as a single argument string. Safest/most portable is to not put anything after the perl there.

Related posts:

  1. Can I place my script in /usr/bin?
  2. How do I reset ownership of /usr/bin/sudo on Linux?
  3. How to install packages on Linux or Solaris on non-default paths?
  4. OpenSSH 5.3 setting UMASK for SFTP chroot env, dosen’t work at all
  5. Access to /usr/bin from web application – CentOS 5 64-bit dedicated hosting

Leave a comment