Hacker News new | ask | show | jobs
by gbrown 1684 days ago
Interesting article, though for me an acceptable middle ground is to just use bash and friends as an interface, as described, and to write any larger and more complicated scripts in Python with argparse (or similar).

I don’t see why the shell must be both nice to program in and a concise textual interface.

3 comments

Shell scripts are the automation and extension of repetitive, tedious manual tasks. Why wouldn't you want to take your shell history and wrap it in some getopt-ish stuff? Or to put it another way, why would you wish to throw away your debugged and working code for a rewrite in another language?
Shell scripts are one way to do this, but I don’t have a library of shell scripts because I always have access to actual scripting languages.

To each their own, but writing bash scripts that get more complex than moving a few files around and sucks (imho), so I don’t bother.

You're missing a step. You originally wrote "I don’t see why the shell must be both nice to program in and a concise textual interface."

I attempted to demonstrate how evolving a CLI session into a script is very beneficial. That bash is not great for that purpose is exactly the point of the article. A better shell language would mean not throwing away your organic, working code for a rewrite.

Unless you're trying to say that you rarely use the command line to explore a system and operate mostly through scripts. I think I would burn a lot of time in writing boiler plate when "curl | grep" would do the job for human consumption in less than 50 keystrokes.

I see what you mean now. I still draw the line differently - I don’t think I’ve ever interactively worked through conditional logic, control loops, or user prompts, so I’d happily make simple bash scripts from basic commands, but I wouldn’t choose to write more complex programs that way.
> I don’t see why the shell must be both nice to program in and a concise textual interface.

Because people just want to have one consistent tooling for everything, and it should be effortless available everywhere. Especially portability is a huge problem.

Good for them, but I have no trouble using different tools for different tasks. I find bash cumbersome to write complex programs in, so I just don’t.
bash is a horrible interface though. Teleprinter compatibility is a bit too much to bear today and really gets in the way, at least for me. On the other hand, I can happily live without all the cool arcane bash features that have crept in over the decades.