- Mastering Linux Shell Scripting
- Andrew Mallett
- 139字
- 2021-07-30 09:40:47
Chapter 3. Conditions Attached
I suppose we can say that we are now into the fine print of the script. These are the details that are written into our scripts using conditions to test if a statement should run or not. We are now ready to add some intelligence in scripts so our scripts become more robust, easier to use, and more reliable. Conditional statements can be written with simple command-line lists of AND
or OR
commands together or, more often, within traditional if
statements.
In this chapter we will cover the following topics:
- Simple decision paths using command-line lists
- Verifying user input with lists
- Using the test shell built-in
- Creating conditional statements using
if
- Extending
if
withelse
- More conditions with
elif
- Creating the
backup.sh
script usingelif
- Using case statements
- Script – front-end with
grep
推薦閱讀
- TypeScript入門與實戰(zhàn)
- JavaScript 從入門到項目實踐(超值版)
- 企業(yè)級Java EE架構(gòu)設(shè)計精深實踐
- 大學計算機基礎(chǔ)實驗教程
- 微服務(wù)與事件驅(qū)動架構(gòu)
- 深入RabbitMQ
- Python編程實戰(zhàn)
- C語言從入門到精通
- App Inventor少兒趣味編程動手做
- Mastering Unreal Engine 4.X
- FusionCharts Beginner’s Guide:The Official Guide for FusionCharts Suite
- 軟件設(shè)計模式(Java版)
- 一步一步學Spring Boot:微服務(wù)項目實戰(zhàn)(第2版)
- HTML5 Canvas核心技術(shù):圖形、動畫與游戲開發(fā)
- VC++ 2008專題應用程序開發(fā)實例精講