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?



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

Answer / 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

More Shell Script Interview Questions

How to open a read-only file in the shell?

0 Answers  


What are the zombie processes?

0 Answers  


write a shell script to identify the given string is palindrome or not?

17 Answers   CTS, HP, IBM, InfoEst, Wipro,


How to create environment variables?What are the conditions for creating variables?

1 Answers   Infosys, Wipro,


write a shell script that counts a number of unique word contained in the file and print them in alphabetical order line by line?

6 Answers   IBM, Wipro,


What is the command to find out today's date?

0 Answers  


What is the lifespan of a variable inside a shell script?

0 Answers  


How to write a function?

0 Answers  


how to print the 2-d, 3-d arrays in unix shell script programs please answer thi questio to my mail venusaikumar@gmail.com

0 Answers  


What are the types of script?

0 Answers  


Is shell scripting easy to learn?

0 Answers  


what is info area how many types?

0 Answers  


Categories