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

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
主站蜘蛛池模板: 宜阳县| 梁河县| 徐水县| 桃园市| 日照市| 凭祥市| 漾濞| 宣汉县| 洛南县| 南郑县| 镇康县| 金坛市| 集安市| 元朗区| 云林县| 仙游县| 梨树县| 水城县| 太湖县| 卓尼县| 柳江县| 临江市| 当阳市| 祥云县| 北票市| 息烽县| 三河市| 稻城县| 洪洞县| 蓬莱市| 天峨县| 南投县| 凉城县| 石柱| 新营市| 读书| 双江| 惠水县| 英超| 平山县| 车致|