[Nix-dev] Re: What happened to python-wrapper?

Peter Simons simons at cryp.to
Thu Apr 14 19:05:35 CEST 2011


Hi Shea,

 > Really? The following worked on my system: [...]

you are right. On some systems, shell scripts can be interpreters for
other scripts. It works on my ArchLinux box, too. On my old Gentoo
machine, however, it doesn't:

 | zuse:/tmp$ cat python.sh
 | #! /bin/sh
 | exec /usr/bin/python "$@"

 | zuse:/tmp$ cat app
 | #! /tmp/python.sh
 | import sys
 | sys.stdout.write("Hello world.\n")

 | zuse:/tmp$ ./python.sh -c 'import sys; sys.stdout.write("Hello world.\n")'
 | Hello world.

 | zuse:/tmp$ ./app
 | ./app: line 3: import: command not found
 | ./app: line 4: syntax error near unexpected token `"Hello world.\n"'
 | ./app: line 4: `sys.stdout.write("Hello world.\n")'

The Gentoo box has Bash 3.x, maybe that is what makes the difference,
but I'm not sure.

Take care,
Peter




More information about the nix-dev mailing list