4 ms·
Well, how do you write that in Python? I'm curious because these simple things that are delightfully easy in bash often turn out to be surprisingly tedious in
by mbrock 10y ago
Well, how do you write that in Python?
I'm curious because these simple things that are delightfully easy in bash often turn out to be surprisingly tedious in other languages.
Of course, some things are tedious in bash too. But a basic principle of shell scripting is that you call other programs to do the stuff you don't want to do in shell.
- IshKebab 10y agoLike this: http://stackoverflow.com/a/1996540 http://stackoverflow.com/a/1996540 I agree it is tedious, but to be honest, reading and writing to stdin/out isn't something that would commonly need to be done in a robust system. If the world were perfect you would use library functions. I definitely think there is scope for a language that works well as an interactive shell, and as a general purpose language. They have somewhat conflicting constraints but I'm sure we can do better than Bash. Have you seen how [ is implemented?
- mbrock 10y agoNo stdout or stdin for robust systems? I disagree. Yeah, a nicer shell-like language would be cool. I've been thinking about it for a while. Bash is quirky but it gets a lot of stuff right and once you understand it it can be extremely ergonomic and productive. And not depending on language run times other than shell can be really glorious in some situations, too...