netstat -anpt | grep port # 查看端口使用情况
$n $1 the first parameter,$2 the second...
$# The number of command-line parameters.$0 The name of current program.$? Last command or function's return value.$$ The program's PID.$! Last program's PID.$@ Save all the parameters.
cd $(dirname "$0") 切换目录到脚本所在地
cd `dirname $0` 其中反引号··等同于$()。
a=`stat -c %Y tmp.txt`;
4 b=`date +%s`; 5 echo $b 6 expiration_time=`echo $EXPIRATION_TIME | awk '{print int($0)}'` 7 echo $expiration_time 8 if [ $[ $b - $a ] -gt $expiration_time ] 9 then 10 echo 'change time great than 180' 11 else 12 echo 'change time not great than 180' 13 fi
awk命令变量匹配
awk -v str1="AA" '$0 ~ str1 {print $2}' myfile
`awk -v str1=$CITY_NAME '$0 ~ str1 {print $1}' $city_id_file_path` 根据字段相同获取改行