Click here to edit subtitle


Post Reply
Forum Home > Unix Learnings > Accessing Command Line Arguments

Sourav Gulati
Site Owner
Posts: 83

Whenever you pass command line arguments toa unix shell script you can access it using $ (dollar sign) with argument number. For example,

the first argument can be accesses as $1, second argument can be accesses as $2 and so on till $9 . However , while accessing 10th argument if you use $10 , it will print value of 1st argument and append 1 to it . For example , if your first argument is "a", it will print a1..So to access it, you have to put it in curly braces{}, For example, if you have to access the 10 argument, you should write is as ${10}. 


August 9, 2012 at 2:30 AM Flag Quote & Reply

You must login to post.