Whitespace in shell script command-line arguments

Source: Internet
Author: User

Look at a little script

#!/bin/bash#demonstarting the shift commandcount=1while"$"  Do          "Parameter # $count =$1" Count 1]                  Shiftdoneechoecho

The script first tests whether the first parameter exists as- n "$" , prints if it exists, and then all parameters move to the left one position, and the value of the variable is overwritten, and the variable $ (that is, the program name) It's not going to change.

Well, let's see.

Note that the above two executes the command anti-white place, the first is the TAB key auto-completion, followed by a space. The second command does not have that white space character behind it.

Take a look at the results, corresponding to the above two commands

Hey, but there's still a print.

Whitespace in shell script command-line arguments

Related Article

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.