[Tutor] Is there space a between "#!" and "/usr/bin/env python" ?

Modulok modulok at gmail.com
Wed May 2 08:13:38 CEST 2012


On 5/1/12, Santosh Kumar <sntshkmr60 at gmail.com> wrote:
> Its getting complicated now. Will it effect or not?

No. It won't. Spaces between '#!' and '/foo/bar/whatever' are ignored.

Long Answer:

Don't worry about it. For example, on one of my Ubuntu linux boxes there's
69 rc files shipped with the OS that use the variant: '#! /bin/sh' (with
space). And there's 26 that use the variant '#!/bin/sh' without a space; It
really doesn't matter. (For the curious, you can find out like this)::

    grep --ignore-case --regex '^#!/. *' --recursive /etc/rc* | wc

And this respectively::

    grep --ignore-case --regex '^#!/.*' --recursive /etc/rc* | wc

On my FreeBSD server all files shipped with the OS don't uses spaces. They're
just '#!/bin/sh'. However, some of my own scripts do, and they work regardless.
i.e. It doesn't really matter. On Windows they're ignored entirely.


-Modulok-


More information about the Tutor mailing list