1. Condition test
1) test
2) [
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M02/85/99/wKiom1epiarg-HB5AABchcrnS3o789.png-wh_500x0-wm_3 -wmp_4-s_2416745738.png "style=" Float:none; "Title=" Captures 4. PNG "alt=" Wkiom1epiarg-hb5aabchcrns3o789.png-wh_50 "/>
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/85/99/wKiom1epianiPo0oAAAsO81SEH4276.png-wh_500x0-wm_3 -wmp_4-s_1246917309.png "title=" Capture 3. PNG "style=" Float:none; "alt=" Wkiom1epianipo0oaaaso81seh4276.png-wh_50 "/>
Test command:
[-D dir]: true if Dir exists and is a directory
[-F file]: True if file exists and is a normal file
[-Z string]: True if the length of the string is zero
[-N string]: True if the length of a STRING is nonzero
[STRING1 = STRING2]: True if two strings are the same
[STRING1! = STRING2]: True if the string is not the same
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/85/98/wKioL1epiavScBF_AABmxbrIWiM464.png-wh_500x0-wm_3 -wmp_4-s_765409488.png "style=" Float:none; "Title=" captures 6. PNG "alt=" Wkiol1epiavscbf_aabmxbriwim464.png-wh_50 "/>
650) this.width=650; "Src=" Http://s5.51cto.com/wyfs02/M02/85/98/wKioL1epiaqwMqsBAAA24Hy1HSs308.png-wh_500x0-wm_3 -wmp_4-s_3362307230.png "title=" Capture 5. PNG "style=" Float:none; "alt=" Wkiol1epiaqwmqsbaaa24hy1hss308.png-wh_50 "/>
3) If statement
If the two commands are written in the same line, they need to be separated from each other, and a single command on one line does not need to be written;
But this command is not finished, the shell will automatically continue, the next line is followed by then as a command processing. As with the command, be aware that the command and parameters must be separated by a space. If the parameter of the IF command consists of a sub-command, if the subcommand's exit status is 0 (true), then the subcommands that follow then are executed, and if exit status is not 0 (false), then the subcommands after elif, else, or fi are executed. A subcommand after an if is usually a test command, but it can also be another command. The shell script does not have {} brackets, so use fi to indicate the end of the IF statement block.
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M00/85/99/wKiom1epiayz08gfAAAj9QEcvtA989.png-wh_500x0-wm_3 -wmp_4-s_2648365473.png "style=" Float:none; "Title=" Captures 8. PNG "alt=" Wkiom1epiayz08gfaaaj9qecvta989.png-wh_50 "/>
650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/85/99/wKiom1epiauB69TAAAAtU9S616w663.png-wh_500x0-wm_3 -wmp_4-s_3699409463.png "title=" Capture 7. PNG "style=" Float:none; "alt=" Wkiom1epiaub69taaaatu9s616w663.png-wh_50 "/>
When the condition is established, use: No.
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/85/99/wKiom1epia2yKW8bAAAQYgEhiOI632.png-wh_500x0-wm_3 -wmp_4-s_3992736194.png "title=" capture 10. PNG "style=" Float:none; "alt=" Wkiom1epia2ykw8baaaqygehioi632.png-wh_50 "/>
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/85/98/wKioL1epiazQJrWmAAAxDrcmufQ122.png-wh_500x0-wm_3 -wmp_4-s_3134393644.png "style=" Float:none; "Title=" Captures 9. PNG "alt=" Wkiol1epiazqjrwmaaaxdrcmufq122.png-wh_50 "/>
4) Case statement
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/85/98/wKioL1epia2xwGH8AAAxJYU6s20604.png-wh_500x0-wm_3 -wmp_4-s_2561514724.png "style=" Float:none; "Title=" captures 12. PNG "alt=" Wkiol1epia2xwgh8aaaxjyu6s20604.png-wh_50 "/>
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/85/98/wKioL1epia2g-OzxAAAvKGFCjuY223.png-wh_500x0-wm_3 -wmp_4-s_756885787.png "title=" Capture 11. PNG "style=" Float:none; "alt=" Wkiol1epia2g-ozxaaavkgfcjuy223.png-wh_50 "/>
5) For Loop statement
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/85/99/wKiom1epia6BsJzpAAA93tAkwt8721.png-wh_500x0-wm_3 -wmp_4-s_2498641597.png "title=" Capture 13. PNG "style=" Float:none; "alt=" Wkiom1epia6bsjzpaaa93takwt8721.png-wh_50 "/>
2. Functions
There are two ways to get the return value of a function:
650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M01/85/98/wKioL1epia7yIFulAAA2kQ1uaNM784.png-wh_500x0-wm_3 -wmp_4-s_667820763.png "style=" Float:none; "title=" captures 14. PNG "alt=" Wkiol1epia7yifulaaa2kq1uanm784.png-wh_50 "/>
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/85/99/wKiom1epia_Cq4lNAAAQsFdHQhA109.png-wh_500x0-wm_3 -wmp_4-s_1488577283.png "style=" Float:none; "title=" captures 15. PNG "alt=" Wkiom1epia_cq4lnaaaqsfdhqha109.png-wh_50 "/>
3. Arrays
Shell scripts support only one-dimensional arrays, only sequential arrays are supported, associative arrays are not supported
650) this.width=650; "Src=" Http://s1.51cto.com/wyfs02/M00/85/99/wKiom1epibDxg05IAABF9IY8Bok862.png-wh_500x0-wm_3 -wmp_4-s_865841970.png "style=" Float:none; "title=" captures 17. PNG "alt=" Wkiom1epibdxg05iaabf9iy8bok862.png-wh_50 "/>
650) this.width=650; "Src=" Http://s4.51cto.com/wyfs02/M02/85/98/wKioL1epia-hSu7aAAAQ882H9yo005.png-wh_500x0-wm_3 -wmp_4-s_1918404924.png "title=" capture 16. PNG "style=" Float:none; "alt=" Wkiol1epia-hsu7aaaaq882h9yo005.png-wh_50 "/>
This article is from the "lovemeright" blog, make sure to keep this source http://lovemeright.blog.51cto.com/10808587/1836149
Shell Script---syntax chapter