How to read command line arguments in a bash script

Posted by xmodulo on Mar 2, 2021 7:21 PM EDT
Xmodulo; By Dan Nanni
Mail this story
Print this story

A bash script rarely runs standalone. Rather, you often pass one or more arguments to the script from the command line to modify its run-time behavior. In more advanced cases, you may want to pass command-line options to your script (e.g., "-h" or "-f my.txt") to optionally change the default settings of the script. In this tutorial let's find out how you can pass command-line arguments and how you can handle command-line options in a bash shell script.

Full Story

  Nav
» Read more about: Story Type: Tutorial; Groups: Linux

« Return to the newswire homepage

This topic does not have any threads posted yet!

You cannot post until you login.