Search code examples
shebangfactor-lang

Factor shebangs


According to Hyperpolyglot, Factor should accept shebangs. But on my system Factor can't handle shebangs.

Specs: Factor v0.94, Mac OS X 10.7

$ cat hello.factor 

\#!/usr/bin/env factor

USE: io
IN: hello

: hello ( -- ) "Hello World!" print ;

MAIN: hello

$ ./hello.factor 

./hello.factor

1: #!/usr/bin/env factor
                 ^
No word named “#!/usr/bin/env” found in current vocabulary search path

Solution

  • Just a guess, but the web page shows a space after the #!:

    #! /usr/bin/env factor
    

    If that doesn't work, it's likely that Hyperpolyglot got this wrong (or perhaps it refers to a different version or implementation of factor).

    Amusingly, when I try the example on my system (Ubuntu), I get:

    /usr/bin/factor: `./hello.factor' is not a valid positive integer
    

    but that's because /usr/bin/factor is the GNU coreutils utility that factors numbers into primes. 8-)}