runxinzhi.com
首页
百度搜索
ATM取款机系统模拟仿真
#!/bin/sh HOSTNAME="localhost" #数据库信息 PORT="3306" USERNAME="root" PASSWORD="" #数据库名称 DBNAME="bank" TABLENAME="user" #两个标记,用于判断是否超过输入 flag=1 flag1=1 #输入帐号密码成功后进行接下来操作 main() { echo "Please input what do you want to do ?(1、Balance inquiries 2、Change Password 3、draw money 4 、Deposit 5、exit) " read choice case $choice in #查询余额 1 ) select_sql_money_now="select money from ${TABLENAME} where name='$name'" nowmoney=` mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD} ${DBNAME} -e "${select_sql_money_now}" |awk '{print $1}'|tail -n1` echo "Balance inquiries is $nowmoney ¥" main ;; #修改密码 2) echo "Please input the new password" read newpassword update_sql_password="update $TABLENAME set password=$newpassword where name='$name'" mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD} ${DBNAME} -e "${update_sql_password}" main ;; #取款 3) echo "Please input how money do you want draw money" read draw select_sql_money_now="select money from ${TABLENAME} where name='$name'" nowmoney=` mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD} ${DBNAME} -e "${select_sql_money_now}" |awk '{print $1}'|tail -n1` if [[ $draw -gt $nowmoney ]] then echo "The card money is little" main else let "nowmoney=$nowmoney-$draw" update_sql="update $TABLENAME set money=$nowmoney where name='$name'"; mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD} ${DBNAME} -e "${update_sql}" fi main ;; #存款 4)echo "Please input how money do you want Deposit money" read deposit select_sql_money_now="select money from ${TABLENAME} where name='$name'" nowmoney=` mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD} ${DBNAME} -e "${select_sql_money_now}" |awk '{print $1}'|tail -n1` let "nowmoney=$nowmoney+$deposit" update_sql="update $TABLENAME set money=$nowmoney where name='$name'"; mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD} ${DBNAME} -e "${update_sql}" main ;; #退出系统 5) echo "Now you level the system!!" exit ;; esac } #输入密码函数 passwordfun() { read password select_sql_pass="select password from ${TABLENAME} where name='$name'" realpassword=` mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD} ${DBNAME} -e "${select_sql_pass}" |awk '{print $1}'|tail -n1` if [[ $password -eq $realpassword ]] then main #密码不对,重新输入 elif [[ $password -ne $realpassword ]] then let "flag++" if [[ $flag -gt 4 ]] then echo "you password enter three times ,the system quit !!" exit 0 fi echo "sorry passwors is wrong,Please input password again" passwordfun fi } echo "Please input the card name:" #输入用户名 #输入用户函数进行判断 namefun() { read name select_sql_name="select name from ${TABLENAME} where name='$name'" real=` mysql -h${HOSTNAME} -P${PORT} -u${USERNAME} -p${PASSWORD} ${DBNAME} -e "${select_sql_name}" |awk '{print $1}'|tail -n1` if [[ -n $real ]] ; then echo "Please input the password:" passwordfun #帐号不对,重新输入 else let "flag1++" if [[ $flag1 -gt 4 ]] then echo "you name enter three times ,the system quit !!" exit 0 fi echo "sorry name is wrong,Please input name again" namefun fi } namefun
相关阅读:
事件委托,元素节点操作,todolist计划列表实例
事件冒泡
jquery事件三 -- load(), ready(), resize()以及bind()事件
jquery事件二 -- 选项卡,失去焦点
jqury动画,循环
jquery事件一 ---鼠标移入移出
例子2--定时器之无缝滚动
例子3--元素绝对位置以及置顶菜单
例子1--手风琴
jquery之链式调用,层级菜单
原文地址:https://www.cnblogs.com/linuxer/p/2441243.html
最新文章
给Java程序猿们推荐一些值得一看的好书
css菜鸟学习之text-align属性,行内元素,块级元素居中详解
css菜鸟学习之block,inline和inline-block概念和区别
css菜鸟之HTML 中块级元素设置 height:100% 的实现
[Spring MVC]
SpringMVC @RequestBody 接收Json数组对象
SpringMVC 之@RequestBody 接收Json数组对象
js数组与 json 的区别
【js】JSON.stringify 语法实例讲解
json字符串、json对象、数组 三者之间的转换
热门文章
浏览器搜索技巧
几种Linux 查询外网出口IP的方法
kafka
kmspico
powerdesigner 遇到的各种问题总结
记一次滑雪之行
生活大爆炸
Maven 错误 Failure to transfer ...was cached in the local repository...
20181031 temp
stackoverflow
Copyright © 2020-2023
润新知