{start..end..step}
# {start..end..step}:指定区间、间隔生成序列for i in {1..100..10}do echo $idonefor i in 5{1..100..10}do echo $idone
${!arr[@]}
# ${!arr[@]}: 返回数组的下标array=(a d dd ddd)for i in ${!array[@]}do echo "---index=$i---value=${array[$i]}"done
${!var}
# ${!var}: 间接引用变量,返回其值var1="test"var2="var1"echo "${!var2}"
命令执行结果复值变量
count=`ps -ef | grep gdms | grep jboss | grep -v "grep" | wc -l`echo $count
shell脚本实现取当前时间
time1=$(date)echo $time1 # Fri Dec 17 19:42:03 CST 2021time2=$(date "+%Y%m%d%H%M%S")echo $time2 # 20211217194244time3=$(date "+%Y-%m-%d %H:%M:%S")echo $time3 # 2021-12-17 19:42:44time4=$(date "+%Y.%m.%d")echo $time4 # 2021.12.17