3 ms·
> it's also that you can run them extremely flexibly: chain them into pipelines, run them in background, redirecting streams Imho traditional shells are actual
by zokier 1y ago
> it's also that you can run them extremely flexibly: chain them into pipelines, run them in background, redirecting streams
Imho traditional shells are actually pretty limited in this regard; you generally can only compose programs in simple linear pipelines with one input one output. Technically bash does allow doing some stuff with additional fds, but it is not very convenient nor flexible in that regard. There have been some attempts to make more flexible shells, like for example dgsh: https://www2.dmst.aueb.gr/dds/sw/dgsh/ https://www2.dmst.aueb.gr/dds/sw/dgsh/
- kjs3 1y agosimple linear pipelines Which is the common case, for which it does a reasonable job. I think if I was looking at most of the directed graph examples, I'd look to another tool than a shell to orchestrate that, rather than say "you know what my shell lacks? More special case syntax.".
- zokier 1y agoSure, sh might be fit for it's purpose, but I wouldn't call it "extremely flexible"
- OskarS 1y agoYou can do that by using mkfifo relatively easy, but I take your point. In that sense, the most "flexible" language is pure C, because you can do anything there. I guess a better word is "ergonomic": if you want to do `curl something | grep whatever > output.txt` in C or Python or whatever other general purpose language, it's MUCH more difficult. Writing lines like that is trivial for me in shell scripting, I just did it in this comment. If I had to do it in Python, I would have to spend 20 minutes studying the precise flags to pass to subprocess.Popen and think really hard about which streams to call .close() on and when. God help me if I was doing it in C and using fork()/exec(). This is the shell scripting super-power, all this stuff is just trivial.