4 ms·
I have a better idea: don't write scripts in shell language at all. They're terrible at basically everything. Instead, use a scripting language, like Python, Ru
by roblabla 8y ago
I have a better idea: don't write scripts in shell language at all. They're terrible at basically everything. Instead, use a scripting language, like Python, Ruby, or Perl. They have control flow that make sense, are not riddled with subtle bugs due to legacy and compatibility reasons, and are simply easier to wield.
Shell scripts are a maintenance nightmare - even when used for personal scripts. They should be avoided at all cost.
- Sir_Cmpwn 8y agoNonsense, shell scripts are an incredibly useful tool for a huge variety of use-cases. Shell can be learned like anything else, and it mostly makes sense when it does. More so than I can say for Ruby and Perl, that's for sure! You should know when to stop and reach for a different tool, but that point isn't before you use shell scripts at all.
- cookiecaper 8y agoRuby and Python are pretty unwieldy for the kind of situations that are well-suited to shell scripts. It's a pain to spawn a command, a pain to make sure you get the process's output in the right place, and just far more overhead than necessary. I agree, however, that classic shells are worse, because they lack many of the niceties expected in modern languages and have opaque, sensitive syntax. fish shell has made me pretty happy. It's a great middle ground. It makes no pretense at POSIX compatibility. Truly a shell for the 90s.
- h1d 8y agoAgreed. There's definitely a good demand for a modern shell scripting language but fish is an existing solution that is saner than bash/zsh. I don't use fish as a shell but for shell scripts only as it acted a bit weird on me, though it's possible I didn't search enough but zsh can cover pretty much all I want from fish with plugins.
- MisterTea 8y agorc from plan 9 is simple but quite powerful and has very clean syntax. It also does away with the cruft in bourn. http://www.scs.stanford.edu/nyu/04fa/sched/readings/rc.pdf http://www.scs.stanford.edu/nyu/04fa/sched/readings/rc.pdf There is a port of a few very useful plan 9 tools, including rc and the Acme editor, in https://9fans.github.io/plan9port/ https://9fans.github.io/plan9port/ https://en.wikipedia.org/wiki/Plan_9_from_User_Space https://en.wikipedia.org/wiki/Plan_9_from_User_Space
- ekianjo 8y agoshell is incredibly powerful when you interact with tools that use piping. Doing the same in python is much more verbose.
- deleted 8y ago[deleted]