Other Hello world Golang script

Indeed, it works like a charm. I tried a bit different comment:
Code:
//usr/bin/env go run "$0" "$@"; exit; */
package main
import "fmt"
func main() { fmt.Println("hello from go")

- /bin/sh suspect
- /bin/tcsh suspect (I use this one)

Both run pretty much the same logic on ENOEXEC (ERR#8 in case you use truss(1))
 
Wow, that's really interesting! From now on, I'm doing C-scripting only 😄

prog.c
C:
/*usr/bin/cc "${0}" && ./a.out ${@}; exit;*/
#include <stdio.h>

int
main(int argc, char **argv)
{
    int i;
    
    for (i = 1; i < argc; i++)
        printf("argv[%d]: %s\n", i, argv[i]);
    return (0);
}

Code:
$ ./prog.c hello world
argv[1]: hello
argv[2]: world
 
Wow, that's really interesting! From now on, I'm doing C-scripting only 😄

prog.c
C:
/*usr/bin/cc "${0}" && ./a.out ${@}; exit;*/
#include <stdio.h>

int
main(int argc, char **argv)
{
    int i;
   
    for (i = 1; i < argc; i++)
        printf("argv[%d]: %s\n", i, argv[i]);
    return (0);
}

Code:
$ ./prog.c hello world
argv[1]: hello
argv[2]: world
LOL it works!
 
Back
Top