We believe that shell scripts have a much higher potential

Over 84.6% of Bash scripts you can find on the Internet don't accept command-line arguments, which greatly limits their usefulness. This has a reason - Bash doesn't make command-line argument parsing easy.

Argbash is a code generator - write a short definition and let Argbash modify your script so it magically starts to expose a command-line interface to your users and arguments passed using this interface as variables.

Teach your script arguments!
Terminal window with an ascii-art smile smile

Make others love your scripts

Learn why.


Sit back, grab a coffee, and enjoy the video of the conference talk below. Let yourself to be told about why Argbash was created and what it can do for you — watch the presentation from the OpenAlt conference.

If you are not interested in the whole and you want to get straight to the point, you can go right to the introduction, overview about arguments processing in Bash, tour over Argbash features, and finally towards the Argbash demo.

What you expect

Teach your script to parse positional and optional arguments in a way that meet other's expectations

Take away

Use argbash to modify your script directly, or get a tailor-made argument parsing library you only have to include

Free and open source

Use this awesome tool online here on argbash.io, or install it on your computer

More to come!

Stay tuned - more features are about to come!

FAQ

Not sure whether Argbash is something you could use? Read on!


  • Who is the audience of Argbash?
    Argbash can benefit anybody who writes Bash shell scripts. By taking over your script's command-line argument parsing, it boosts your script's user-friendliness at a negligible cost for you as the developer.
  • How makes Argbash scripts to be user-friendly?
    Typically, people hardcode paths and other parameters of the task they automate with the script, they rely on environment variables or they just accept positional arguments with no flexibility. Argbash makes it easy for your script to accept all kinds of command-line arguments in a flexible manner and you even get a comprehensive help message as a bonus. With Argbash, you can stop studying scripts just to find out how to call them!
  • This was not possible before the Argbash project has not been introduced?
    It was possible, but it was unclear how to approach this problem — see, for instance, the number of answers to the fundamental question on StackOverflow, Shelldorado or a renowned Bash best practices wiki. Argbash's unique approach combines positives from the highest rated suggestions above.
  • So how to parse command-line arguments in Bash in the best way?
    Argbash is an excellent choice. The general consensus is that the best way of handling script argument means you have to write the parsing code all by yourself (check out the links in the previous answer). And Argbash does better than that, it generates that code, and it is a self-contained high-quality code. It takes the best from approaches mentioned in this concise list of alternatives. Moreover, the online generator gets you on the track really quickly, so there is virtually no excuse for not giving Argbash a try.
  • Argbash online generator? This sounds good, but what if I am offilne?
    Argbash is free and open-source software, the generator on the website is mainly for convenience. Installing Argbash locally is very easy and you are encouraged to do so. The online generator is just a frontend, you can achieve the same result at home without major obstacles. If you use it on a server where the Docker daemon is running, you can check out the Argbash Docker image
  • OK, so how do I get started with Argbash?
    If you can spare a minute or two, take a look at the minimal example that you can pass to the online generator and play with it. If you are more into Argbash offline, you have a great quickstart guide.
  • What can I do to help the Argbash project?
    You can contact us if you are interested in packaging Argbash - we would like to make it easier for you. Another problem with Argbash is that it is a hidden gem — even the most awesome thing can't be useful to many if only few people know about it. Therefore, tell your friends, colleagues, CTO!
  • Argbash is so cool, it already saved me a lot of time. Can I support it financially?
    That's very kind, thanks! However, set the money aside as you can't send us any money at the moment, but stay tuned!
  • What if I wanted to ask about something different?
    Contact us, we will be pleased to answer and share the answer if possible!

Start making your scripts
Awesome. Now.

Go to argbash online generator Run on your computer Read the docs

It can't get simpler than this!

  1. Think out what arguments would you like your script to support.
  2. Write a template and paste it into the appropriate field and get the parsing shell code.
  3. You can either include it in your script, or you can have everything in one file.
  4. You want to change something? Just modify the template section of the script, paste it into the generator and see what happens!