Shift Move Variable

Source: Internet
Author: User

Script sh05. SH

#!/bin/bash# program# Program shows the effect ofShift function# history:# -/9/6ZENGDP First Releasepath=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/Binexport PATHEcho "Total parameter number is ==> $#"Echo "whole parameter is ==> ' [email protected] '"ShiftEcho "Total parameter number is ==> $#"Echo "whole parameter is ==> ' [email protected] '"Shift 3Echo "Total parameter number is ==> $#"Echo "whole parameter is ==> ' [email protected] '"

Run sh sh05. SH One, three four five six

Get

 Total parameter number is ==> 6  you Whole P Arameter is  ==>  " one-Three four fi ve six   " total parameter number is  = = = 5  you whole parameter is  ==> 
   
     '  
   

Just look at the results and you'll know, that shift shifts the variables, and the shift can be followed by numbers, representing the meaning of taking away the first few arguments. In the results above, the first shift followed by his display is "one two three four five six", so there are five left! The second time take three directly, become "two three four five six"! Can this case be understood? Do you understand the function of shift?

Shift Move Variable

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.