DEAR PEOPLE FROM THE FUTURE: Here's what we've figured out so far...

Welcome! This is a Q&A website for computer programmers and users alike, focused on helping fellow programmers and users. Read more

What are you stuck on? Ask a question and hopefully somebody will be able to help you out!
+3 votes

Other unix/posix-like shells are fine too.

Alternately, what are the best practices for writing a usage function for bash? I typically try to get mine to look like something that python argparse would produce with ./script_name --help. In the past I've even mocked my bash script up in python.

by
+1

usage function = help function?

+1

Just curious but why use Bash then? :) Python is preinstalled in pretty much every distro except the most minimal.

0

Yes, I mean usage function as in a help function.

This question is mostly for existing code at my day job. I almost always encourage using python, otherwise. I've been thinking a few different things. Maybe there's a tool that works with getopts. I found this after I posted the question, but I haven't had a chance to try it out yet:

https://github.com/Anvil/bash-argsparse

Or maybe there exists a tool I could get non-programmers to write them in, maybe I could use that, or use pandoc after that to generate the usage prompt and put that in a function.

Please log in or register to answer this question.

Contributions licensed under CC0
...