[Swift-devel] shebangs

Ben Clifford benc at hawaga.org.uk
Thu Sep 20 05:16:08 CDT 2007


I just noticed that swift programs can be run with shebang syntax, like 
this:

$ chmod a+x manyloop.swift 
$ ./manyloop.swift 

if the swift executor is specified in the first line of the program, like 
this:

#!/usr/bin/env swift

type messagefile;

(messagefile t) greeting(string m) { 
    app {
        echo m stdout=@filename(t);
    }
}

int loopmax=10;

print("manyloop with ",loopmax," jobs");

foreach i in [1:loopmax] {
    messagefile outfile 
<single_file_mapper;file=@strcat("manyloop",i,".txt")>;
    outfile = greeting(@strcat("this is output file ",i));
}

-- 




More information about the Swift-devel mailing list