一.echo命令 #1.直接显示字符串 echo "It is a test" #输出:It is a test #2.显示转义字符 echo "\"It is a test\"" #输出:"It is a test" #3.显示变量 name=Shell echo "$name It is a test" #输出:Shell is a test #4.显示换行 echo -e "OK! \n&q…
1. 编写shell脚本,计算1-100的和: #! /bin/bash sum=0 for i in `seq 1 100`; do sum=$[$i+$sum] done echo $sum 计算-00和 2. 编写shell脚本,要求输入一个数字,然后计算出从1到输入数字的和,要求,如果输入的数字小于1,则重新输入,直到输入正确的数字为止: #! /bin/bash n=0 " ]; do read -p "Please input a number, it must great…