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

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

主站蜘蛛池模板: 夹江县| 盈江县| 义乌市| 克东县| 定襄县| 如皋市| 永福县| 斗六市| 繁峙县| 宜宾县| 长白| 望奎县| 和田市| 抚顺市| 乐至县| 固安县| 衢州市| 怀安县| 五寨县| 乌拉特后旗| 陵川县| 霸州市| 和平区| 迁西县| 囊谦县| 安康市| 甘孜| 乌拉特前旗| 鹤岗市| 新闻| 客服| 林周县| 余江县| 华蓥市| 城口县| 巴东县| 苏尼特左旗| 文登市| 乌拉特中旗| 盈江县| 长岭县|