- 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
推薦閱讀
- Python從入門到精通(精粹版)
- C語言從入門到精通(第4版)
- C語言程序設計實踐教程
- MATLAB實用教程
- PySide GUI Application Development(Second Edition)
- Redis Essentials
- Android 應用案例開發大全(第3版)
- 組態軟件技術與應用
- Microsoft 365 Certified Fundamentals MS-900 Exam Guide
- Learning Node.js for .NET Developers
- UML軟件建模
- AI自動化測試:技術原理、平臺搭建與工程實踐
- Kotlin進階實戰
- HTML5移動Web開發
- 3ds Max 2018從入門到精通