1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
| touch online.sh
echo "Hello World !"
chmod +x ./online.sh
/bin/sh online.sh
for file in `ls /etc`
your_name="qinjx" echo $your_name echo ${your_name}
myUrl="http://www.w3cschool.cc" readonly myUrl
unset variable_name
echo "\"It is a test\"" echo -e "OK! \n" echo '$name' string="runoob is a great site" echo ${#string} echo ${string:1:4}
echo $string $string1
echo `expr index "$string" is`
array_name=(value0 value1 value2 value3) array_name[n]=valuen
${array_name[1]} ${array_name[@]} , ${array_name[*]}
${#array_name[0]} ${#array_name[@]} 或者 ${#array_name[*]}
$0,$1,$2... $# $* , $@ $$ $!
val=`expr 2 + 2`
=: !=: -z: -n: str:
-b,-c,-d,-f,-g,-k,-p,-u,-r,-w,-x,-s,-e
read name echo "$name It is a test"
printf
if test $[num1] -eq $[num2] then echo '两个数相等!' else echo '两个数不相等!' fi
if condition1 then command1 elif condition2 then command2 else commandN fi
for var in item1 item2 ... itemN do command1 command2 ... done
int=1 while(( $int<=5 )) do echo $int let "int++" done
until condition do command done
case var in 1) command1 ;; 2) command2 ;; esac
break continue
[function] demoFun(){ echo "demo" return ($#,$*); }
cat test.txt > test1.txt cat test.txt >> test1.txt
command > /dev/null
command > /dev/null 2>&1
. ./test1.sh 或者 source ./test1.sh
|