官术网_书友最值得收藏!

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 with else
  • More conditions with elif
  • Creating the backup.sh script using elif
  • Using case statements
  • Script – front-end with grep
主站蜘蛛池模板: 成安县| 梁河县| 日喀则市| 莫力| 惠水县| 新余市| 康平县| 阿拉尔市| 元阳县| 左权县| 苏州市| 乐陵市| 阳朔县| 永安市| 巴彦县| 张家川| 玉林市| 昭苏县| 保德县| 喀喇| 安顺市| 建水县| 道孚县| 新密市| 义乌市| 富顺县| 开封市| 孟村| 尚义县| 蕉岭县| 布尔津县| 伊吾县| 洛宁县| 永川市| 兴和县| 句容市| 尤溪县| 霍林郭勒市| 平南县| 东至县| 太仓市|