What happens if the dot ' ' is written as single quotation mark ' or double quotation mark ' in the write of the bash script?

Source: Internet
Author: User

Write a test script:

Input Start command: test.sh, result error

The root user is used, but the permissions are still insufficient.

Input/bin/sh test.sh, you can start the script, but the syntax error:

Error message The loop variable is not correct. Baidu a bit this error, explained as follows:

Because Ubuntu is replacing the traditional bash with dash in order to speed up the boot, the loop is written differently in Dash. To run this script, you must use bash test.sh.

Perform ls-l/bin/*sh to see:

In Ubuntu,/bin/sh is a symbolic link to dash, so to use bash syntax, use the Bash command.
Use bash to test and run successfully:

Test results:

Instead of creating 10 files, only two files were created.

The result is equally wrong

Test results, correct! :

Note that the dot ' is entered in English mode at the far left of the keyboard, below the ESC key.

What happens if the dot ' ' is written as single quotation mark ' or double quotation mark ' in the write of the bash script?

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.