shebang in cross platform scripts

Discussion in 'Python' started by rbt, Apr 6, 2005.

  1. rbt

    rbt Guest

    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
    rbt, Apr 6, 2005
    #1
    1. Advertising

  2. On Apr 6, 2005 2:37 PM, rbt <> wrote:

    > 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.

    --
    Cheers,
    Simon B,
    ,
    http://www.brunningonline.net/simon/blog/
    Simon Brunning, Apr 6, 2005
    #2
    1. Advertising

  3. rbt wrote:

    >
    > 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.

    --
    Regards,

    Diez B. Roggisch
    Diez B. Roggisch, Apr 6, 2005
    #3
  4. rbt

    Bill Mill Guest

    On Apr 6, 2005 9:37 AM, rbt <> wrote:
    >
    > 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
    Bill Mill, Apr 6, 2005
    #4
  5. Hi All--

    Simon Brunning wrote:
    >
    > On Apr 6, 2005 2:37 PM, rbt <> wrote:
    >
    > > 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.
    >


    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
    Ivan Van Laningham, Apr 6, 2005
    #5
  6. rbt

    Bill Mill Guest

    On Apr 6, 2005 11:06 AM, Ivan Van Laningham <> wrote:
    > Hi All--
    >
    > Simon Brunning wrote:
    > >
    > > On Apr 6, 2005 2:37 PM, rbt <> wrote:
    > >
    > > > 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.
    > >

    >
    > 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
    Bill Mill, Apr 6, 2005
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jcc
    Replies:
    15
    Views:
    4,674
    Nigel Wade
    May 12, 2006
  2. Coca
    Replies:
    15
    Views:
    628
    Alan Balmer
    Jan 14, 2004
  3. Kaspar Schiess

    platform.rb (was: PLATFORM tests)

    Kaspar Schiess, Nov 25, 2005, in forum: Ruby
    Replies:
    0
    Views:
    113
    Kaspar Schiess
    Nov 25, 2005
  4. Claudio

    cross-platform shell scripts

    Claudio, Jan 4, 2005, in forum: Perl Misc
    Replies:
    16
    Views:
    237
    Michele Dondi
    Jan 5, 2005
  5. Piotr Dobrogost
    Replies:
    9
    Views:
    83
    Piotr Dobrogost
    Feb 21, 2014
Loading...

Share This Page