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

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
主站蜘蛛池模板: 丽江市| 内乡县| 广水市| 仙桃市| 平阳县| 广西| 栖霞市| 上高县| 阳城县| 余姚市| 页游| 邓州市| 连云港市| 闵行区| 宁晋县| 凉城县| 阿合奇县| 绥阳县| 江阴市| 迭部县| 娱乐| 南漳县| 启东市| 六枝特区| 象山县| 桑植县| 新乐市| 鄢陵县| 河北区| 剑阁县| 荔浦县| 灵寿县| 建昌县| 崇阳县| 贺州市| 祁连县| 石门县| 古丈县| 钟祥市| 滕州市| 项城市|