Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

What is the use of "shift" command in passing parameters?

Answer Posted / satchi

"shift" is useful when you need to access positional
parameters more than 9.

EX- execute a script to display 11th position parameter.

#./test.sh 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th
12th

shell scripts limits the access of arguments up to 9.to
over come this calculate the position of argument you want
to access and use shift to pull inside 9th countdown.

ex:
withen the script write "shift 2" before "echo $9"to
display 11th parameter.

withen the script write "shift 3" before "echo $9"to
display 12th parameter.

Is This Answer Correct ?    8 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Write a script to print the first 10 elements of fibonacci series.

2284


What are the 3 standard streams in linux?

1061


What language is used in terminal?

943


What does debug script mean?

927


What is the difference between grep and egrep?

1076


How will you find the 99th line of a file using only tail and head command?

2482


How does ls command work?

981


What is wc in shell script?

937


Where is bash history?

867


How many fields are present in a crontab file and what does each field specify?

1068


Why do we write bin bash in shell scripts?

965


What are "c" and "b" permission fields of a file?

975


What does path stand for?

1002


Why is the use of shell script?

938


What will happen to my current process when I execute a command using exec?

989