[Swift-user] #!/bin/bang

Ben Clifford benc at hawaga.org.uk
Mon Oct 1 04:47:16 CDT 2007


I've seen this happen a couple of times recently from different people, so 
here's a note about it.

When writing a unix script, you should put the first line to be the 
interpreter specification (such as #!/bin/bash or #!/usr/bin/perl).

This must be on the very first line, so that the first two bytes of the 
file are #!

If you are writing a shell script and omit that, you will find that in 
some contexts the shell script will run successfully and in other contexts 
it will not work.

The specific example I've seen in swift is running shell scripts from 
swift - if you omit the initial #!/bin/bash, then: if you run with 
kickstart, they will not work; if you run without kickstart, they will 
work (because of the different ways in which the kickstart and 
non-kickstart mechanisms invoke executables). If the #!/bin/bash is 
present, then the script will work in both cases.

-- 



More information about the Swift-user mailing list