Using arguments to a Unix Shell Script

This tutorial will show you how to pass arguments to shell script.

Create and write the below content in it.

echo "My first name is $1"
echo "My last name is $2"
echo "Total number of arguments is $#"

Run the script

$ ./ Soumitra Roy
My first name is Soumitra
My last name is Roy
Total number of arguments is 2

Thanks for reading.

Soumitra Roy Sarkar

I am a professional Web developer, Enterprise Application developer, Software Engineer and Blogger. Connect me on Twitter Facebook  Google Plus Linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *