Any language is a shell script if you're brave enough: https://en.wikipedia.org/wiki/Shebang_%28Unix%29
Exactly #!/usr/bin/tcc -run #include int main(int argc, char **argv) { printf("Hello from C!\n"); for (int i = 1; i 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)
Amber the programming language compiled to Bash/Ksh/Zsh
21–30 of 72 posts
Re: Amber the programming language compiled to Bash/Ksh/Zsh
#22Re: Amber the programming language compiled to Bash/Ksh/Zsh
#23unclear use case imo - this sacrifices the ergonomics of actual bash scripting, and hides it behind another language If your script is complex enough to need a higher level language you might as well just switch to python
Re: Amber the programming language compiled to Bash/Ksh/Zsh
#24> Typescript to bash Literally the worst of both worlds.
Re: Amber the programming language compiled to Bash/Ksh/Zsh
#25Earlier quoted context omitted.
Exactly #!/usr/bin/tcc -run #include int main(int argc, char **argv) { printf("Hello from C!\n"); for (int i = 1; i 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)
Can you change the current working directory? If not, it's not a shell script.
$ cat bscript.sh && echo "---" && ./bscript.sh
#!/usr/bin/bash
cd testdir/
ls
---
dummyfile
in C you can change dir easily via `chdir()`[1] $ cat cscript && echo "---" && ./cscript
#!/usr/bin/tcc -run
#include
#include
#include
int main(void)
{
if (chdir("testdir") == -1) {
perror("chdir");
return EXIT_FAILURE;
}
execlp("ls", "ls", (char *)NULL);
perror("execlp");
return EXIT_FAILURE;
}
---
dummyfile
[1] https://www.man7.org/linux/man-pages/man2/chdir.2.htmlIf you meant somehow changing the parent shell's directory an ordinary bash script doesn't do that either
Re: Amber the programming language compiled to Bash/Ksh/Zsh
#26Earlier quoted context omitted.
Exactly #!/usr/bin/tcc -run #include int main(int argc, char **argv) { printf("Hello from C!\n"); for (int i = 1; i 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)
Can you change the current working directory? If not, it's not a shell script.
Or did you mean change the directory of the calling shell (in which case, executable shell scripts written in Bash and friends can’t do that either).
Re: Amber the programming language compiled to Bash/Ksh/Zsh
#27Hm... But why not use Python
Re: Amber the programming language compiled to Bash/Ksh/Zsh
#28Side note: the image of project founder cosplaying as Steve Jobs on front page had me dying.
Re: Amber the programming language compiled to Bash/Ksh/Zsh
#29This looks great. We have a lot of bash tools because it's the only stable interpreter that we have readily available on all our systems. But bash is a pain to write so this might actually make things easier.
How many places do you have Bash, but not AWK?
Re: Amber the programming language compiled to Bash/Ksh/Zsh
#30In a world where AI can generate any code for any environment, is there a need for another language? On the other hand, we're at a point for a binary language (or standard / framework) that one AI/LLM creates and another one validates. What are we missing?