Shell tip:
1. Need to add ' $ ' when referencing variables
2.shell variable viewing and deletion
Set | grep variable name//view Set Variable unset variable name//delete variable
The difference between single and double quotes in 3.shell
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/79/4B/wKioL1aN7XfQiFViAAGB_fWKF4E818.jpg "title=" 1.jpg " alt= "Wkiol1an7xfqifviaagb_fwkf4e818.jpg"/>
Note : Single quotation marks are assigned to variables; double quotation mark cancels the function of the space
4. Anti-quotes, assigning a shell command to a variable
650) this.width=650; "src=" http://s5.51cto.com/wyfs02/M01/79/4B/wKioL1aN5OSyUfsXAACbpWRO9k8305.jpg "title=" 2.jpg " alt= "Wkiol1an5osyufsxaacbpwro9k8305.jpg"/>
5.read: Read data, assign to variable
650) this.width=650; "src=" http://s2.51cto.com/wyfs02/M01/79/4B/wKioL1aN5ZCiJRKzAACRHPdpjAw111.jpg "title=" 3.jpg " alt= "Wkiol1an5zcijrkzaacrhpdpjaw111.jpg"/>
6.EXPR: Arithmetic operations on integer variables
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M02/79/4B/wKioL1aN5hTxLIpwAADzTcWPegg880.jpg "title=" 4.jpg " alt= "Wkiol1an5htxlipwaadztcwpegg880.jpg"/>
Note: Notice the space, \ is escaped, cancels the special meaning of *
If statement:
vim if.sh#!/bin/bash //specifies that the shell //script that runs the script begins #file: if.sh echo ' Hello, how old are you? ' echo ' please input your age: ' read age //read-in data if [ $age -eq 28 ]; then echo "You ' re at the age of marriage! " elif [ $age -gt 28 -a $age -lt 35 ]; then //Judging age between 28 to 35 echo "You must go on a blind date now. " elif [ $age -lt 28 ]; then echo "You ' re still young and good to learn!" else echo "Sorry, i don ' t kown your age!" fi //script End chmod +x if.sh //gives execute permission ./if.sh //script execution script under current path
This article from "Experience from pain" blog, declined reprint!
Shell---If statement