- 1). Open the Bash script you would like to accept input parameters. This can be done by opening your favorite text editor.
- 2). Decide what command line handles you would like your script to respond to. Commands take the form <command> <input parameters .... >, where each of the parameters is separated by a space.
- 3). In your script, use the parameters as necessary. They can be accessed using the global environment variables $1, $2 and so forth for each respective handle. In plain English, when a user enters a command, Bash automatically captures the input parameters and hands them to us to use in conveniently defined variables.
next post