[Alan@LCS.MIT.EDU: Fun with shell scripts!] Marc Feeley 23 May 2001 11:50 UTC
For the benefit of the SRFI-22 discussion list, here are results sent to me by Alan Bawden. It confirms that SunOS 4.1.4.1 has a 32 character limit. Otherwise, both "#! /usr/bin/env ..." and "#!/usr/bin/env ..." seem to work on all platforms tested up to now. Marc ------------------------------------------------------------------------------- The SunOS 4.1.4.1 result is the most interesting... ======= FreeBSD 3.4 ======= testscript 1.0 FreeBSD snowview.camellia.org 3.4-RELEASE FreeBSD 3.4-RELEASE #8: Sat Oct 7 00:11:55 EDT 2000 xxxxxx@snowview.camellia.org:/usr/src/sys/compile/HELOISE i386 Wed May 23 02:05:31 EDT 2001 -------------------- ./script1 #! /usr/bin/env cat -------------------- ./script2 #!/usr/bin/env cat -------------------- ./script3 -------------------- ./script4 -------------------- ./script5 ./script5: not found -------------------- ./script6 ./script6: not found -------------------- ./script7 -------------------- ./script8 ======= SunOS 4.1.4.1 ======= testscript 1.0 SunOS mc 4.1.4 1 sun4c Wed May 23 02:18:53 EDT 2001 -------------------- ./script1 #! /usr/bin/env cat -------------------- ./script2 #!/usr/bin/env cat -------------------- ./script3 No such file or directory: ./script3-helper -------------------- ./script4 No such file or directory: ./script4-helper- -------------------- ./script5 #! /bin/env cat -------------------- ./script6 #!/bin/env cat -------------------- ./script7 No such file or directory: ./script7-helper-fil -------------------- ./script8 No such file or directory: ./script8-helper-file ======= NetBSD 1.5 ======= testscript 1.0 NetBSD bronze.lcs.mit.edu 1.5 NetBSD 1.5 (GENERIC) #1: Wed Nov 29 00:29:52 MET 2000 xxxxxx@flambard:/usr/src/sys/arch/sparc/compile/GENERIC sparc Wed May 23 02:15:46 EDT 2001 -------------------- ./script1 #! /usr/bin/env cat -------------------- ./script2 #!/usr/bin/env cat -------------------- ./script3 -------------------- ./script4 -------------------- ./script5 ./script5: not found -------------------- ./script6 ./script6: not found -------------------- ./script7 -------------------- ./script8 ======= Irix ======= testscript 1.0 IRIX64 world 6.2 03131016 IP19 Wed May 23 06:17:49 GMT 2001 -------------------- ./script1 #! /usr/bin/env cat -------------------- ./script2 #!/usr/bin/env cat -------------------- ./script3 #! /usr/bin/env cat #! /usr/bin/env ./script3-helper-file890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567 -------------------- ./script4 #!/usr/bin/env cat #!/usr/bin/env ./script4-helper-file7890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567 -------------------- ./script5 #! /bin/env cat -------------------- ./script6 #!/bin/env cat -------------------- ./script7 #! /bin/env cat #! /bin/env ./script7-helper-file4567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567 -------------------- ./script8 #!/bin/env cat #!/bin/env ./script8-helper-file34567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567 ======= SunOS ======= testscript 1.0 SunOS shell3 5.8 Generic_108528-05 sun4u sparc SUNW,Ultra-60 Wed May 23 02:19:55 EDT 2001 -------------------- ./script1 #! /usr/bin/env cat -------------------- ./script2 #!/usr/bin/env cat -------------------- ./script3 #! /usr/bin/env cat #! /usr/bin/env ./script3-helper-file890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567 -------------------- ./script4 #!/usr/bin/env cat #!/usr/bin/env ./script4-helper-file7890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567 -------------------- ./script5 #! /bin/env cat -------------------- ./script6 #!/bin/env cat -------------------- ./script7 #! /bin/env cat #! /bin/env ./script7-helper-file4567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567 -------------------- ./script8 #!/bin/env cat #!/bin/env ./script8-helper-file34567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567 ======= Linux (Debian) ======= testscript 1.0 Linux suhr 2.2.17 #2 SMP Thu Sep 14 21:01:22 EDT 2000 i686 unknown Wed May 23 02:25:33 EDT 2001 /nfs/raid/home/alan/testscript-tmp -------------------- ./script1 #! /usr/bin/env cat -------------------- ./script2 #!/usr/bin/env cat -------------------- ./script3 #! /usr/bin/env cat #! /usr/bin/env ./script3-helper-file890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567 -------------------- ./script4 #!/usr/bin/env cat #!/usr/bin/env ./script4-helper-file7890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567 -------------------- ./script5 sh: ./script5: No such file or directory -------------------- ./script6 sh: ./script6: No such file or directory -------------------- ./script7 sh: ./script7: No such file or directory -------------------- ./script8 sh: ./script8: No such file or directory ======= End =======