随笔分类 -  Bash

摘要:#!/bin/env sh program=`basename $0|awk -F. '{print $1}'` lock=/var/lock/subsys/$program source /etc/rc.d/init.d/functions function start(){ if [ -e $l 阅读全文
posted @ 2020-05-26 19:11 ascertain 阅读(145) 评论(0) 推荐(0)
摘要:bash中即使declare -x或export的变量,子shell可以引用和改变,但是该改变无法作用到父shell中. 阅读全文
posted @ 2020-05-26 10:50 ascertain 阅读(143) 评论(0) 推荐(0)
摘要:1 #!/bin/env sh 2 3 declare -i p z 4 5 for ((p=1;p<=9;p++));do 6 for ((z=1;z<=p;z++));do 7 echo -e "${z}X${p}=$[p*z]\t\c" 8 done 9 echo 10 done 11 12 阅读全文
posted @ 2020-05-25 19:23 ascertain 阅读(176) 评论(0) 推荐(0)
摘要:#!/bin/env sh source /etc/rc.d/init.d/functions declare -i p=1 declare -i online=0 declare -i offline=0 net='192.168.8' while [[ $p -le 10 ]];do ping 阅读全文
posted @ 2020-05-25 18:59 ascertain 阅读(449) 评论(0) 推荐(0)
摘要:1 #!/bin/env bash 2 3 declare -i max min 4 declare -a mm 5 6 for z in `seq 1 1 10`;do 7 if [[ $z -eq 1 ]];then 8 max=min=$RANDOM 9 mm[$z]=$max 10 cont 阅读全文
posted @ 2020-05-25 18:13 ascertain 阅读(1762) 评论(0) 推荐(0)