• Articles Automation Career Cloud Containers Kubernetes Linux Programming Security
  • About About Enable Sysadmin Email newsletter Join the community Sudoers program Meet the team FAQs

Adding arguments and options to your Bash scripts

%t min read | by David Both (Sudoer alumni)

Adding arguments and options to your Bash scripts

Image by Gerd Altmann from Pixabay

One of the most important tools for most sysadmins is automation. We write and maintain scripts to automate the common and frequent tasks that we must perform.

I have dozens of scripts—short and long—that I've written and modified over the years. Some of my most useful scripts have been to perform regular backups early each morning, install updated software packages with fixes and enhancements, and upgrade from one version of Fedora to the next. I just upgraded all of my personal hosts and servers to Fedora 34 a few days ago using a fairly simple script.

Two of the most common things I do for all my scripts are creating a help function and a function that displays the GPL3 license statement. I like to include verbose or test modes to assist in problem determination in my scripts. In some scripts, I also pass values such as a user name, the version of Fedora to upgrade to, file names, and more.

The ability to use positional parameters—otherwise known as arguments—to specify data to be used as values for variables in the scripts is one method for accomplishing this. Another is the use of options and option arguments. This article explores these two methods for getting data into the script and controlling the script's execution path.

[ Download now: A sysadmin's guide to Bash scripting . ]

Positional parameters

Bash uses a tool called positional parameters to provide a means of entering data into a Bash program when it is invoked from the command line. There are ten positional parameters that run from $0 through $9 , although there are ways to hack around that limit.

Starting with a simple script that displays an entered name on the screen. Create a file called script1.sh with the following content and make it executable.

I placed this script in my ~/bin directory , where personal executable files such as scripts are intended to be stored. Look at your $PATH variable, which contains /home/username/bin as one component. If the ~/bin directory does not exist, you can create it. Or you can just put this file wherever you want and use it from there.

Then run the script with no parameters.

The output from this script is the name of the script. The $0 parameter is reserved and predefined as the name of the running script and cannot be used for any other purpose. This can be handy inside a script because you don't need to pass the script its own name if it requires it.

So change the script to use $1 for the positional variable, and run it again:

Run it again, this time using a single parameter:

What happens if the parameter is two words?

That is actually two parameters, but you can remedy that with quotes, as seen here:

This can be helpful where the input is supposed to be a street address or something with multiple words, like this:

But there are times when you do need multiple parameters, such as with names or full addresses.

[ You might also like:  More stupid Bash tricks: Variables, find, file descriptors, and remote operations ]

Change the program to look like this:

And run it using the parameters as shown:

Of course, there are many ways to use the positional parameters once values have been assigned, but this little program makes it easy to see what is happening. It also makes it easy to experiment in a safe way.

[ Free download: Advanced Linux commands cheat sheet . ]

Try putting the parameters in a different order to see how that works. These parameters are positional, and that is a key consideration. You must consider how many parameters are needed, how the user remembers them, and what order to place them.

You need a way to make the order of the parameters irrelevant and still need a way to modify the execution path.

You can do those two things using command line options.

I find that even simple Bash programs should have some sort of help facility, even if it is fairly rudimentary. Many of the Bash shell programs I write are used infrequently enough that I may forget the exact syntax of the command I need to issue. Some are just so complex that I need to review the options and arguments required even though I use them frequently.

Having a built-in help function allows you to view those things without resorting to inspecting the code itself. A good and complete help facility is also one part of program documentation.

About functions

Shell functions are lists of Bash program statements stored in the shell's environment and can be executed like any other command by typing its name at the command line. Shell functions may also be known as procedures or subroutines, depending upon which other programming language you might be using.

[ Get this free Bash shell scripting cheat sheet . ]

Functions are called in your scripts or from the CLI by using their names, just as you would for any other command. In a CLI program or a script, the commands in the function are executed when called. Then the sequence of program flow returns to the calling entity, and the next series of program statements in that entity is executed.

The syntax of a function is:

FunctionName(){program statements}

Create a simple function at the CLI. The function is stored in the shell environment for the shell instance in which it is created. You're going to create a function called hw , which stands for Hello world . Enter the following code at the CLI and press Enter . Then enter hw as you would any other shell command.

Ok, so I am a little tired of the standard "Hello world!" I usually start with. Now list all of the currently defined functions. There are a lot of them, so I have shown just the new hw function. When called from the command line or within a program, a function performs its programmed task. It then exits, returning control to the calling entity, the command line, or the next Bash program statement in a script after the calling statement.

Now remove that function because you don't need it anymore. You can do that with the unset command, like this:

The hello.sh script

Create a new Bash shell script, ~/bin/hello.sh , and make it executable. Add the following content, keeping it basic to start:

Run it to verify that it prints "hello world!"

I know—I can't help myself, so I went back to "hello world!".

Creating the help function

Add the help function shown below to the code of the hello program. Place the help function between the two statements you already have. This help function will display a short description of the program, a syntax diagram, and a short description of each available option. You also add a call to the help function to test it and some comment lines that provide a visual demarcation between the functions and the main portion of the program.

The program now looks like this.

The options described in this help function might be typical in the programs I write, although none are yet present in the code. Run the program to test it.

Because you haven't added any logic to display the help when you want it, the program will always display the help. However, you know that the function is working correctly, so you can add some logic only to show the help when you use a -h option at the command line invocation of the program.

[ Want to test your sysadmin skills? Take a skills assessment today . ]

Handling options

The ability for a Bash script to handle command line options such as -h to display help gives you some powerful capabilities to direct the program and modify what it does. In the case of your -h option, you want the program to print the help text to the terminal session and then quit without running the rest of the program. The ability to process options entered at the command line can be added to the Bash script using the while command in conjunction with the getops and case commands.

The getops command reads any and all options specified at the command line and creates a list of those options. The while command loops through the list of options by setting the variable $options for each in the code below. The case statement is used to evaluate each option in turn and execute the statements in the corresponding stanza. The while statement will continue to assess the list of options until they have all been processed or an exit statement is encountered, which terminates the program.

Be sure to delete the help function call just before the echo "Hello world!" statement so that the main body of the program now looks like this.

Notice the double semicolon at the end of the exit statement in the case option for -h . This is required for each option. Add to this case statement to delineate the end of each option.

Testing is now a little more complex. You need to test your program with several different options—and no options—to see how it responds. First, check to ensure that with no options that it prints "Hello world!" as it should.

That works, so now test the logic that displays the help text.

That works as expected, so now try some testing to see what happens when you enter some unexpected options.

Handling invalid options

The program just ignores the options for which you haven't created specific responses without generating any errors. Although in the last entry with the -lkjsahdf options, because there is an "h" in the list, the program did recognize it and print the help text. Testing has shown that one thing that is missing is the ability to handle incorrect input and terminate the program if any is detected.

You can add another case stanza to the case statement that will match any option for which there is no explicit match. This general case will match anything you haven't provided a specific match for. The case statement now looks like this.

This bit of code deserves an explanation about how it works. It seems complex but is fairly easy to understand. The while – done structure defines a loop that executes once for each option in the getopts – option structure. The ":h" string —which requires the quotes—lists the possible input options that will be evaluated by the case – esac structure. Each option listed must have a corresponding stanza in the case statement. In this case, there are two. One is the h) stanza which calls the Help procedure. After the Help procedure completes, execution returns to the next program statement, exit;; which exits from the program without executing any more code even if some exists. The option processing loop is also terminated, so no additional options would be checked.

Notice the catch-all match of \? as the last stanza in the case statement. If any options are entered that are not recognized, this stanza prints a short error message and exits from the program.

Any additional specific cases must precede the final catch-all. I like to place the case stanzas in alphabetical order, but there will be circumstances where you want to ensure that a particular case is processed before certain other ones. The case statement is sequence sensitive, so be aware of that when you construct yours.

The last statement of each stanza in the case construct must end with the double semicolon ( ;; ), which is used to mark the end of each stanza explicitly. This allows those programmers who like to use explicit semicolons for the end of each statement instead of implicit ones to continue to do so for each statement within each case stanza.

Test the program again using the same options as before and see how this works now.

The Bash script now looks like this.

Be sure to test this version of your program very thoroughly. Use random input and see what happens. You should also try testing valid and invalid options without using the dash ( - ) in front.

Using options to enter data

First, add a variable and initialize it. Add the two lines shown in bold in the segment of the program shown below. This initializes the $Name variable to "world" as the default.

Change the last line of the program, the echo command, to this.

Add the logic to input a name in a moment but first test the program again. The result should be exactly the same as before.

$OPTARG is always the variable name used for each new option argument, no matter how many there are. You must assign the value in $OPTARG to a variable name that will be used in the rest of the program. This new stanza does not have an exit statement. This changes the program flow so that after processing all valid options in the case statement, execution moves on to the next statement after the case construct.

Test the revised program.

The completed program looks like this.

Be sure to test the help facility and how the program reacts to invalid input to verify that its ability to process those has not been compromised. If that all works as it should, then you have successfully learned how to use options and option arguments.

In this article, you've used positional parameters to enter data into the Bash program during invocation from the command line and used options to direct the flow of the program as well as to enter data into the program. You added a help function and the ability to process command line options to display the help selectively. And you added an optional argument that allows entering a name on the command line.

This little test program is designed to be simple, so you can easily experiment with it yourself to test this input method on your own. As an exercise, revise the program to take a first name and last name. Try entering the options for first and last names in reverse order to see what happens.

Check out these related articles on Enable Sysadmin

Bash automation

David Both is an open source software and GNU/Linux advocate, trainer, writer, and speaker who lives in Raleigh, NC. He is a strong proponent of and evangelist for the "Linux Philosophy." David has been in the IT industry for over 50 years. More about me

Try Red Hat Enterprise Linux

Download it at no charge from the red hat developer program., related content.

A row of old tools for cutting and carving


Privacy Statement


Beginners guide to use script arguments in bash with examples

Table of Contents

How to pass and store arguments to shell script? How to parse input arguments inside shell script? How to pass arguments to a function inside shell script in bash? How to read command line arguments in shell script?

In this tutorial we will cover these questions covering bash script arguments with multiple scenarios and examples. I will try to be as detailed as possible so even a beginner to Linux can easily understand the concept.

How input arguments are parsed in bash shell script

Generally we pass arguments to a script using this syntax

Now to store all these arguments inside the script in a single variable we can use " [email protected] "

But to store these arguments in individual variable, you can assign the values based on the numerical position of the input argument. You can check this sample script where I am storing upto 4 arguments in individual variables. You can use any names for the variable, I have used these just for better understanding. Here any argument after 4th place will be ignored.

Beginners guide to parse script arguments in bash scripts

Let,s execute this script:

So as expected the script has successfully stored the input arguments and printed them on the screen

Method 1: Parse input arguments with if condition and while loop

In this example we will use if condition to parse the input arguments and perform respective action. Here I have written a small script which is expected to collect following input arguments

Beginners guide to use script arguments in bash with examples

Let us understand this script:

You can execute the script by shuffling the order of input arguments and it should still work. Although I am not a big fan of this method as it is very messy and I would prefer case over if condition if the number of input arguments is more than 3.

When should we use “shift” when working with input arguments

Method 2: Parse input arguments with case statement and while loop

In this example we will use case statement with while loop to check for input arguments. As you can see the script looks much cleaner compared to the one with if condition:

I don't think I need to again explain this part of the script line by line. Here I have switched the position of shift so now if $1 matches the condition such as -r or --rpm then I do the shift so now second argument has become the first for me so I store the first argument into RPM_NAME and print the same

We can execute the script and verify in any possible order:

Handling exceptions and errors with bash script arguments

Scenario 1: missing value for input argument.

In all the examples above we also worked on success use case. But what if you were expecting an input argument with a value but the user forgot to pass a value ? In such case your entire loop can break. Let's use the above case statement to demonstrate this:

As expected I did not gave a value for -r so -s was considered as the rpm name and then 10 was considered as an input argument. Since we have not defined 10 as a supported input arg, the script failed and printed the usage function.

So it is very important that we handle such error scenarios. Now the handling may vary from case to case. For example if you are only expecting an integer as a value for some input argument then you can add that check, let me show you some examples:

In this script I have added below addition check:

So we know that all our input arguments start with hyphen so if the value of input argument starts with hyphen then it means that a value was not provided.

Let's test this script, and it works perfectly this time:

Scenario 2: Count input arguments list

Another possible scenario of failure would be where we expect only 2 input arguments but the user gives more then 2 input arguments , so we should add a check for supported arguments:

Here we will count the list of minimum supported arguments and if it is greater than 3 then print a message with usage section and exit:

Let's verify our script:

Scenario 3: When script is executed without any argument

Similarly what if the user executes the script without any input argument? In such case also we should exit by showing the usage section:

So I have added one more check in the same if condition, let's verify this script:

Similarly you can add multiple checks based on your requirement.

In this tutorial I showed you different examples to executed input arguments with bash scripts. You can use similar logic when handling input arguments for functions in shell scripts. If you have any custom scenario which you need help with then you can use the comment box below to give as much detail as possible and I will try to help you out.

Lastly I hope the steps from the article to learn bash script arguments on Linux was helpful. So, let me know your suggestions and feedback using the comment section.

Didn't find what you were looking for? Perform a quick search across GoLinuxCloud

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can either use the comments section or contact me form.

Thank You for your support!!

Leave a Comment Cancel reply

Save my name and email in this browser for the next time I comment.

Notify me via e-mail if anyone answers my comment.

Javatpoint Logo

Shell Scripting

Executing Script

Shell parameters, shell sourcing, shell getopts, shell loops, advance shell.


Look at the above snapshot, this is the script we have written to show the different parameters.

Linux  Script parameters 2

Look at the above snapshot, we have passed arguments 1, 5, 90 . All the parameters show their value when script is run.


Help Others, Please Share


Learn Latest Tutorials

Splunk tutorial


Tumblr tutorial

Reinforcement Learning

R Programming tutorial

R Programming

RxJS tutorial

React Native

Python Design Patterns

Python Design Patterns

Python Pillow tutorial

Python Pillow

Python Turtle tutorial

Python Turtle

Keras tutorial



Verbal Ability

Interview Questions

Interview Questions

Company Interview Questions

Company Questions

Trending Technologies

Artificial Intelligence

Artificial Intelligence

AWS Tutorial

Cloud Computing

Hadoop tutorial

Data Science

Angular 7 Tutorial

Machine Learning

DevOps Tutorial

B.Tech / MCA

DBMS tutorial

Data Structures

DAA tutorial

Operating System

Computer Network tutorial

Computer Network

Compiler Design tutorial

Compiler Design

Computer Organization and Architecture

Computer Organization

Discrete Mathematics Tutorial

Discrete Mathematics

Ethical Hacking

Ethical Hacking

Computer Graphics Tutorial

Computer Graphics

Software Engineering

Software Engineering

html tutorial

Web Technology

Cyber Security tutorial

Cyber Security

Automata Tutorial

C Programming

C++ tutorial

Control System

Data Mining Tutorial

Data Mining

Data Warehouse Tutorial

Data Warehouse

Javatpoint Services

JavaTpoint offers too many high quality services. Mail us on [email protected] , to get more information about given services.

Training For College Campus

JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected] Duration: 1 week to 2 week

RSS Feed

// Tutorial //

How to read command line arguments in shell scripts.

Default avatar

While we believe that this content benefits our community, we have not yet thoroughly reviewed it. If you have any suggestions for improvements, please let us know by clicking the “report an issue“ button at the bottom of the tutorial.

Reading user input is one part of the equation. In today’s article, we’ll learn to read command-line arguments in shell scripts. Shell scripts are an essential tool for any Linux user. They play a major role in automating daily tasks and creating your own commands or macros.

These shell scripts can receive input from the user in the form of arguments.

When we pass arguments to a shell script, we can use them for local sequencing of the script. We can use these arguments to obtain outputs and even modify outputs just like variables in shell scripts .

What are Command-Line Arguments?

Command-line arguments are parameters that are passed to a script while executing them in the bash shell.

They are also known as positional parameters in Linux.

We use command-line arguments to denote the position in memory where the command and it’s associated parameters are stored. Understanding the command-line arguments is essential for people who are learning shell scripting.

In this article, we will go over the concept of command-line arguments along with their use in a shell script.

How Shell Scripts Understand Command Line Arguments

Command-line arguments help make shell scripts interactive for the users. They help a script identify the data it needs to operate on. Hence, command-line arguments are an essential part of any practical shell scripting uses.

The bash shell has special variables reserved to point to the arguments which we pass through a shell script. Bash saves these variables numerically ($1, $2, $3, … $n)

Here, the first command-line argument in our shell script is $1, the second $2 and the third is $3. This goes on till the 9th argument. The variable $0 stores the name of the script or the command itself.

We also have some special characters which are positional parameters, but their function is closely tied to our command-line arguments.

The special character $# stores the total number of arguments. We also have [email protected] and $* as wildcard characters which are used to denote all the arguments. We use $$ to find the process ID of the current shell script, while $? can be used to print the exit code for our script.

Read Command-line Arguments in Shell Scripts

Now we have developed an understanding of the command-line arguments in Linux. Now it’s time to use this knowledge for practical application of the netstat command.

For this tutorial, we will go over an example to learn how to use the command-line arguments in your shell script.

First, we will create a shell script to demonstrate the working of all the reserved variables which we discussed in the previous section. Use nano or any preferred editor of your choice and copy the following.

This is the shell script which we plan to use for this purpose.

Once we are done, we will save the script as PositionalParameters.sh and exit our text editor.

Now, we will open the command line on our system and run the shell script with the following arguments.

The script will run with our specified arguments and use positional parameters to generate an output. If you followed the step correctly, you should see the following screen.

Reading Arguments

Our output shows the correct output by substituting the reserved variables with the appropriate argument when we called it.

The process was run under the process ID 14974 and quit with the exit code 0.

Wrapping up

Being able to read command-line arguments in shell scripts is an essential skill as it allows you to create scripts that can take input from the user and generate output based on a logical pathway.

With the help of command-line arguments, your scripts can vastly simplify the repetitive task which you may need to deal with on a daily basis, create your own commands while saving you both time and effort.

We hope this article was able to help you understand how to read the command line arguments in a shell script. If you have any comments, queries or suggestions, feel free to reach out to us in the comments below.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about us

Still looking for an answer?

Creative Commons

Popular Topics

Try DigitalOcean for free

Join the tech talk.

Please complete your information!

script argument examples

Getty Images/iStockphoto

How to script a Bash Shell argument

This tutorial teaches you how to add arguments to your bash scripts, which can simplify and automate a variety of linux tasks in the data center and eliminate hassle..

Jack Wallen

Linux shell scripts make it possible for admins to create tasks and automate them with the help of a tool such as cron. Shell scripts can be as simple as a single line command, or can contain multiple nested lines that run numerous tasks.

Shell scripts are often called Bash scripts because Bash is the most common default shell in Linux. They call upon one or more applications to handle various jobs. You can use Bash scripts to pass arguments to those internal applications, which means you don't have to edit the script when values related to those applications change.

For example, if you use AppX in a shell script and AppX requires you to let it know that DIRECTORYZ is the location that houses the necessary data to complete its task, you could write a line in the shell script reads something like:

/usr/bin/AppX -d /DIRECTORYZ

When you no longer want AppX to use DIRECTORYZ, or if AppX must use a dataset from different directories depending on the situation, you can either manually edit that line in the script to reflect the correct dataset or you can employ arguments.

What are arguments?

Arguments represent different options passed to a command. You can add the following to the example shell script to create more arguments:

ls -I README file 'file 1' file2

The command now has five arguments:

The same command also has three positional parameters:

A script designates positional parameters as $0, $1, $2, $3, $4 and so forth. These parameters enable you to pass arguments from the command line to a script.

Crafting a script to use arguments

Every Bash script begins with the line:


That tells the script to use Bash. A simple script enables you to input arguments that are passed to the script and then used for output.

The first section of the script prints out the total number of arguments to pass to the scripts and then prints out the value of each argument. That section looks like this:

echo "Total Number of Arguments:" $#

echo "Argument values:" [email protected]

$# expands to reflect the number of arguments passed to a script. This means you can enter as few or as many arguments as you require. When you use this variable, it automatically designates the first variable at $0, the second at $1, the third at $2 and so on.

The second variable, [email protected] , expands to all parameters when calling a function. Instead of listing the total arguments as a value, it lists them all out as typed.

To create the actual Bash script, issue the command:

nano script.sh

Into that script paste the following:

Save and close the file. Give the file executable permission with the command:

chmod u+x script.sh

If you run the script without passing arguments, the output is:

Total Arguments: 0

All Arguments values:

Instead, run the script and pass arguments with the command:

./script.sh ARG0 ARG1 ARG2 ARG3 ARG4 ARG5 ARG6 ARG7 ARG8 ARG9

The output of that command is then:

Total Arguments: 10

All Arguments values: ARG0 ARG1 ARG2 ARG3 ARG4 ARG5 ARG6 ARG7 ARG8 ARG9

You can make that same script more useful by accessing only specific arguments. For example, if you want to print out the first and last argument, you could include:

echo "First Argument:" $1

echo "Tenth Argument:" ${!#}

The script now uses $1 for the first variable, because $0 prints out the command ./script.sh as its first argument. The {!#} variable, the last argument passed to the script, combines the argument count with indirection , which enables you to reference something using a name, reference or container instead of the value itself.

Add the second section to the script, so it looks like:

echo "Last Argument:" ${!#}

If you run that command like so:

The output should be:

First Argument: ARG0

Last Argument: ARG9

Simplifying the Bash scripting process

You can make this script a bit more practical. For example, you could create a backup script that uses rsync to back up a directory to a USB-attached drive mounted at the /backup directory.

If you previously backed up the same directory, that script might look like:

rsync -av --delete /Directory1/ /backup

Use arguments to define the directory to be backed up from the terminal. The new script looks like:

rsync -av --delete $1 /backup

Call that script backup.sh .

If you have a directory -- for the purposes of this example, a directory named PROJECT4 -- you can back it up to the /backup directory by issuing the command:

./backup.sh PROJECT4

You can then back up any directory you want by passing the name of the directory to the backup script as an argument.

You can build on these fundamental exercises to expand your knowledge of arguments. Bash scripts can become incredibly powerful tools to simplify Linux administration tasks.

Try out PowerShell grep equivalents with these examples

Dig deeper on data center ops, monitoring and management.

script argument examples

Bourne shell


Hierarchical Kubernetes namespaces explained by example


How to create and run a shell script in Linux and Ubuntu


IT pros who manage with PowerShell will run into the double-hop problem and use CredSSP to work around it. This tutorial offers a...

By using the .NET WebClient class and PowerShell, Windows admins can upload and download files to FTP. Review the general process...

PowerShell's Pester troubleshooting tool lets users write and run tests. Learn how to install the tool and examine a step-by-step...

Azure management groups, subscriptions, resource groups and resources are not mutually exclusive. Businesses can -- and often do ...

Amazon CodeGuru reviews code and suggests improvements to users looking to make their code more efficient as well as optimize ...

Establishing sound multi-cloud governance practices can mitigate challenges and enforce security. Review best practices and tools...

Pure Storage expanded its storage offerings with FlashBlade//E designed for the unstructured data market with an acquisition cost...

Data governance manages the availability, usability, integrity and security of data. Follow these best practices for governance ...

Vast Data Universal Storage brought out data services, including set performance, metadata cataloging, better security, container...


  1. A change of ways

    script argument examples

  2. For this homework you will write a script to do some

    script argument examples

  3. Sample Argument Outline

    script argument examples

  4. Execute Shell Script with Argument 😧

    script argument examples

  5. Argument Essays; Academic Essays & General Essays

    script argument examples

  6. debate script example for opposition

    script argument examples


  1. What is an argument?

  2. What is an Argument ? Sample Statement |CSS/PMS| #politicalscience #css2023

  3. Rhetoric 101

  4. Lesson 1

  5. 24

  6. Lesson 1 Welcome "A Clear Logical Argument Guaranteed"


  1. Adding arguments and options to your Bash scripts

    Two of the most common things I do for all my scripts are creating a help function and a function that displays the GPL3 license statement.

  2. How to Use Command Line Arguments in a Bash Script

    Let's take an example of the following script, userReg-positional-parameter.sh, which prints username, age, and full name in that order:

  3. Shell Script Parameters

    All Shell Script Parameters with Examples ; $#, It parameter represents the total number of arguments passed to the script. ; $0, This parameter represents the

  4. Beginners guide to use script arguments in bash with examples

    But to store these arguments in individual variable, you can assign the values based on the numerical position of the input argument. You can check this sample

  5. Shell Script Parameters

    Shell Script Parameters ; ${10}-${n}, Represent positional parameters for arguments after nine ; $0, Represent name of the script ; $∗, Represent all the

  6. How to Read Command Line Arguments in Shell Scripts?

    #!/bin/sh echo "Script Name: $0" echo "First Parameter of the script is $1" echo "The second Parameter is $2" echo "The complete list of

  7. Command Line Arguments in Unix Shell Script with Example

    In this tutorial we will understand how to work with Command Line Arguments also know as command line parameters. These arguments

  8. How to script a Bash Shell argument

    Use arguments in your Bash scripts to automate a variety of ... For example, if you use AppX in a shell script and AppX requires you to let

  9. Drama Script Argument in the car

    DRAMA: “ARGUMENT IN THE CAR”. (DRA002). Aim of Script: To show how easy it is to walk the path of unforgiveness and to keep a “record of wrongs” against

  10. Shell Script Examples

    bin/bash # example of using arguments to a script echo "My first name is $1" echo ... The first example simply counts the number of lines in an input file.