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

  • Bash Cookbook
  • Ron Brash Ganesh Naik
  • 115字
  • 2021-07-23 19:17:32

Getting program input parameters 

Retrieving program input parameters or arguments is very similar to function parameters at the most basic level. They can be accessed in the same fashion as $1 (arg1), $2 (arg2), $3 (arg3), and so on. However, so far, we have seen a concept called flags, which allows you to perform neat things such as-l, --long-version, -v 10, --verbosity=10. Flags are effectively a user-friendly way to pass parameters or arguments to a program at runtime. For example:

bash myProgram.sh -v 99 --name=Ron -l Brash

Now that you know what flags are and how they can be helpful to improve your script, use the following section as a template.

主站蜘蛛池模板: 吉木萨尔县| 云龙县| 濮阳市| 扶绥县| 澄江县| 济南市| 太仓市| 阜宁县| 乐都县| 垫江县| 五河县| 德惠市| 安平县| 丰原市| 华容县| 修武县| 精河县| 嘉兴市| 仁怀市| 丰镇市| 南乐县| 彭州市| 巩留县| 南开区| 南宁市| 万载县| 冕宁县| 开阳县| 红河县| 高雄市| 平原县| 东莞市| 石渠县| 昌都县| 金塔县| 德钦县| 清河县| 库伦旗| 西乡县| 甘肃省| 九台市|