logoalt Hacker News

ivanjermakovtoday at 6:04 PM1 replyview on HN

Any language is a shell script if you're brave enough: https://en.wikipedia.org/wiki/Shebang_%28Unix%29


Replies

b-kftoday at 7:20 PM

Exactly

  #!/usr/bin/tcc -run
  
  #include <stdio.h>
  
  int main(int argc, char **argv)
  {
      printf("Hello from C!\n");
  
      for (int i = 1; i < argc; ++i)
          printf("argument %d: %s\n", i, argv[i]);
  
      return 0;
  }
And ready is your cscript :)

  $ chmod u+x cscript && ./cscript hello world
  Hello from C!
  argument 1: hello
  argument 2: world
(I can't even articulate why I love it so much that this works)
show 1 reply