3 ms·
IMHO instead of offering a builtin programming language, shells should make it easy to launch scripts written in 'foreign' languages (maybe via a more informati
by flohofwoe 2y ago
IMHO instead of offering a builtin programming language, shells should make it easy to launch scripts written in 'foreign' languages (maybe via a more informative shebang block at the top). I want to write my 'shell scripts' in Python, Typescript or Lua and those scripts should work on any shell and on any platform (including Windows outside WSL).
- dotancohen 2y agoThat's what /usr/bin/env is for: a standard path to reference interpreters. There is still the issue of the proper interpreter actually being installed, however.
- flohofwoe 2y ago> There is still the issue of the proper interpreter actually being installed, however. Yeah, that's what I mean with "make it easy". The script header should announce requirements (like what language and language version it is written in, and the shell should be able to ensure those requirements before running the script - without ignoring security aspects of course). E.g. every script should be able to bootstrap itself, no matter what programming language is used (and that might even include compiled languages).
- poincaredisk 2y agoThis is already possible with #!/usr/bin/env nix-shell
- kragen 2y agounix tried that in the 70s, ms-dos batch files tried it in the 80s. turns out offering a builtin programming language is good actually