-
两个文件之间进行比较查看全部
-
111查看全部
-
until 格式查看全部
-
while 格式查看全部
-
单分支条件语句注意点查看全部
-
多重条件判断查看全部
-
字符串的判断查看全部
-
两个整数之间比较查看全部
-
两个文件之间进行比较查看全部
-
按照文件权限进行判断查看全部
-
按照文件类型进行判断查看全部
-
流程控制语句查看全部
-
#!/bin/bash read -t 30 -p "Please input yes/no:" cho case "$cho" in "yes") echo "You input yes!" ;; "no") echo "You input no!" ;; *) echo "Please input yes/no!" ;; esac查看全部
-
#!/bin/bash read -t 30 -p "Please input a file name:" file if [ -z "$file" ] then echo "Error, please input a file name!" exit 11 elif [ ! -e "$file" ] then echo "Your input is not a file name!" exit 22 elif [ -f "$file" ] then echo "$file is a regular file!" elif [ -d "$file" ] then echo "$file is a directory !" else echo "$file is another file!" fi查看全部
-
#!/bin/bash read -t 30 -p "Please input num1:" num1 read -t 30 -p "Please input num2:" num2 read -t 30 -p "Please input operator:" ope if [ -n "$num1" -a -n "$num2" -a -n "$ope" ] then test1=$(echo $num1 | sed 's/[0-9]//g') test2=$(echo $num2 | sed 's/[0-9]//g') if [ -z "$test1" -a -z "$test2" ] then if [ "$ope" == '+' ] then result=$(($num1+$num2)) elif [ "$ope" == '-' ] then result=$(($num1-$num2)) elif [ "$ope" == '/' ] then result=$(($num1 / $num2)) elif [ "$ope" == '*' ] then result=$(($num1*num2)) else echo "Error: the input operator is worng, please input +-*/" exit 111 fi else echo "Error: Please input numbers!" exit 222 fi echo "$num1 $ope $num2 is $result" else echo "Error: You input null value!" exit 333 fi查看全部
举报
0/150
提交
取消