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

  • 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.

主站蜘蛛池模板: 罗定市| 荃湾区| 尼玛县| 吉安县| 红安县| 巩留县| 泉州市| 镇平县| 大悟县| 青浦区| 婺源县| 宁化县| 沙河市| 汉寿县| 嘉善县| 南投县| 乳山市| 乌兰察布市| 石门县| 临清市| 同德县| 修水县| 肃南| 诸城市| 廊坊市| 什邡市| 清苑县| 尤溪县| 武鸣县| 乌什县| 沾化县| 汉寿县| 布拖县| 若羌县| 金堂县| 丹巴县| 平遥县| 临清市| 清流县| 商都县| 五原县|