linux shell编程(计算器示例)
2015-12-06 21:14
465 查看
#!/bin/bash while [ "0" == "0" ] do read -p "please in put the number1 :" num1 read -p "please in put the number2 : " num2 read -p "please in put your wants : " flag if [ "$num1" == "0" ] && [ "$num2" == "0" ];then break fi case $flag in "+") echo $(($num1+$num2)) ;; "-") echo $(($num1-$num2)) ;; "*") echo $(($num1*$num2)) ;; "/") echo $(($num1/$num2)) ;; "%") echo $(($num1%$num2)) ;; esac read -p "do you want to continue : " yn if [ "$yn" == "N" ] || [ "$yn" == "n" ];then break fi done exit 0
相关文章推荐
- 《Linux命令、编辑器与Shell编程》读书笔记5-用户和文件权限管理
- -bash: /bin/rm: Argument list too long的解决办法
- -bash: /bin/rm: Argument list too long的解决办法
- shell脚本启动storm 集群
- Shell编程
- linux笔记 第九天 软raid、bash循环进阶、lvm详解、压缩和归档工具
- Linux的Shell脚本中IF流程控制语句的基本语法
- SHELL笔记-2
- 【Solved】XShell Vim、终端乱码问题
- shell 中的算术运算
- shell排序
- linux 下shell
- bash shell的ANSI控制
- android玩耍(-) adbshell安装
- 一起talk C栗子吧(第七十一回:C语言实例--DIY shell)
- 工具类-vim在shell中卡死的情况
- 在shell脚本中调用另一个脚本的三种不同方法(fork, exec, source)——转载
- ssh登录报错-bash: fork: retry: Resource temporarily unavailable
- 一段强大的shellcode
- 【Data Structure】nlogn-SortMethods(Quick/Heap/Shell/Merge)