4 ms·
As soon as I start adding ifs and battling to remember the exact syntax I give up and move to Python and argparse. Recently I've started using the Begins[1] lib
by jaymzcampbell 9y ago
As soon as I start adding ifs and battling to remember the exact syntax I give up and move to Python and argparse. Recently I've started using the Begins[1] library to make useful command line tools and scripts even more quickly. I appreciate it's less and less portable at this stage but so much more productive. Most of the time these scripts are very specific anyway so it's not a concern.
The other thing I've noticed amongst peers is that I'm usually the only one (or one of a limited few) that remotely understand the shell script too. So I'd serve the team better writing it with Python. YMMV with that of course.
[1] http://begins.readthedocs.io/en/latest/ http://begins.readthedocs.io/en/latest/
- mcintyre1994 9y agoBegins looks awesome, thanks for sharing! :)
- yjftsjthsd-h 9y agoThanks for pointing to Begins! I suspect some of this is just a difference in background or culture; shell conditionals look completely obvious and intuitive to me, and I'm pretty sure my team can handle shell better than python.
- xelxebar 9y agoThere is a lot of historical arcana baked into the command line and bash, but I've found it worth learning like any other language. Anyway, just for future reference you can use bash's `help` command to get documentation about builtins. In the case of conditionals, we want to loo at `test`: $ help test I find this a lot easier than wading through the bash man page.
- tslug 9y agoHoly crap, xelxebar. Thank you! This is a game-changer. I've been wading through the bash man pages like a fool.