셸 컴 퓨 팅 스 크 립 트

#!/bin/bashprint_usage () {printf "please enter an inteper "}read -p "Please input first number:" firstnumwhile [ " echo "$firstnum" | sed -r 's#[^0-9]##g' " != "$firstnum" ]doprint_usageread firstnumdoneread -p "Please input the operators:" operatorswhile [ "$operators" != "+" ]&&[ "$operators" != "-" ]&&[ "$operators" != "" ]&&[ "$operators" != "/" ]doread -p "please use + - /" operatorsdoneread -p "Please input second number:" secondnumwhile [ " echo "$secondnum" | sed -r 's#[^0-9]##g' " != "$secondnum" ]doprint_usageread secondnumdoneecho "${firstnum}${operators}${secondnum} =$((${firstnum}${operators}${secondnum}))"echo "$$" >/var/run/jsq.pid

좋은 웹페이지 즐겨찾기