Linux Shell脚本编程初体验

2019-09-23 09:24:54于海丽

done

运行:

[root@localhost ~]# ./note.sh
Phone number: 454
Name: Malini
Issue: Windows license expired.
===== We got calls from =====
3 123
1 321
1 454
1 777
--------------------------------
Phone number: ^C

当前场景贯穿了几个熟知的步骤:

●显示消息
●获取用户输入
●存储值到文件
●处理存储的数据


但是,如果用户有点责任心,他有时候需要输入数据,有时候需要统计,或者可能要在存储的数据中查找一些东西呢?对于这些事情,我们需要使用switches/cases,并知道怎样来很好地格式化输出。这对于在shell中“画”表格的时候很有用。

来自:Linux中国
原文:http://linoxide.com/linux-shell-script/guide-start-learning-shell-scripting-scratch/
作者: Petras Liumparas
译文:LCTT https://linux.cn/article-5591-1.html
译者: GOLinux