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?