shebang in cross platform scripts

R

rbt

Haven't tested this on Windows yet... thought I'd ask here:

Does the line below have any negative impact on Windows machines? I
develop and test mostly on Unix, but my scripts are often used on Win
systems too.

#!/usr/bin/env python

Many thanks,

rbt
 
S

Simon Brunning

Does the line below have any negative impact on Windows machines? I
develop and test mostly on Unix, but my scripts are often used on Win
systems too.

#!/usr/bin/env python

Nope. On Windows it's just a comment.
 
D

Diez B. Roggisch

rbt said:
Haven't tested this on Windows yet... thought I'd ask here:

Does the line below have any negative impact on Windows machines? I
develop and test mostly on Unix, but my scripts are often used on Win
systems too.

#!/usr/bin/env python

Thanks to the # being the comment sign in python, it will be silently
discarded by windows.
 
B

Bill Mill

Haven't tested this on Windows yet... thought I'd ask here:

Does the line below have any negative impact on Windows machines? I
develop and test mostly on Unix, but my scripts are often used on Win
systems too.

#!/usr/bin/env python

What the others have said already is true, that it will be ignored on
windows, with one caveat. The shebang is interpreted by Apache if your
script is a CGI script. So, if your script is a CGI, you will need to
have a windows version and a nix version.

Peace
Bill Mill
bill.mill at gmail.com
 
I

Ivan Van Laningham

Hi All--

Simon said:
Nope. On Windows it's just a comment.

It works fine using cygwin, uwin, mks and pdksh, all available for
Windows. Google is your friend.

Symbolic links also work under uwin (don't know for sure about the
others). That means you can install a link in /usr/bin to whereever
python lives, and expect #!/usr/bin/python to work just fine.

Metta,
Ivan
----------------------------------------------
Ivan Van Laningham
God N Locomotive Works
http://www.andi-holmes.com/
http://www.foretec.com/python/workshops/1998-11/proceedings.html
Army Signal Corps: Cu Chi, Class of '70
Author: Teach Yourself Python in 24 Hours
 
B

Bill Mill

Hi All--



It works fine using cygwin, uwin, mks and pdksh, all available for
Windows. Google is your friend.

Symbolic links also work under uwin (don't know for sure about the
others). That means you can install a link in /usr/bin to whereever
python lives, and expect #!/usr/bin/python to work just fine.

This works in cygwin as well; I didn't mention cygwin since the OP
seemed to be asking about windows distribution, but it's a good point.

Peace
Bill Mill
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top