- 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.
推薦閱讀
- PHP動態(tài)網(wǎng)站程序設(shè)計(jì)
- Java應(yīng)用與實(shí)戰(zhàn)
- Node.js 10實(shí)戰(zhàn)
- R語言經(jīng)典實(shí)例(原書第2版)
- The DevOps 2.4 Toolkit
- Scala謎題
- Learning Hunk
- Python全棧數(shù)據(jù)工程師養(yǎng)成攻略(視頻講解版)
- Mastering React
- 計(jì)算機(jī)應(yīng)用基礎(chǔ)教程(Windows 7+Office 2010)
- SSH框架企業(yè)級應(yīng)用實(shí)戰(zhàn)
- 一步一步學(xué)Spring Boot:微服務(wù)項(xiàng)目實(shí)戰(zhàn)(第2版)
- Python程序設(shè)計(jì):基礎(chǔ)與實(shí)踐
- Internet of Things with Arduino Cookbook
- 多接入邊緣計(jì)算實(shí)戰(zhàn)