- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
shell 函数(国外英语资料)
shell 函数(国外英语资料)
Use data variables in the Shell
Users can use data variables in the Shell, such as the ba. Sh program:
CD/usr/icewalk
Ls | cpio-o / dev/fd0
The directory to be backed up in this program is a constant, which is that the program can only be used to back up a directory. If you use variables in this program, you make it more generic:
Workdir = $1
CD $workdir
Ls * | cpio-o / dev/fd0
With this change, the user can use the directory specified by the program backup variable $workdir. For example, we need to back up/home/WWW content, as long as we run the ba. Sh/home/WWW. (if you dont understand $1, youll detail the passing of the shell parameter, $1 to represent the first parameter of the program - ba. Sh.)
4 adds comments to the Shell program
To increase the readability of the program, we advocate adding comments. The comment in the Shell program starts with the # sign. When the Shell explains #, it will assume that it has been commenting from the # to the line end of the line.
5 does arithmetic for Shell variables
A variable in a high-level language is a type that is limited to a data type, such as an integer or a character type. Shell variables are typically stored by characters, and the expr command is required to perform arithmetic operations on Shell variables.
The expr command will take an arithmetic expression as a parameter, usually as follows:
Expr [number] [the number] [the number]
Since the Shell is stored as a character, the user must ensure that the number of operands required to participate in arithmetic operations must be numeric. Here are valid arithmetic operators:
Plus two integers
Minus the first number minus the second number
Multiplying by two integers
/ the first integer is divided by the second integer
The two integers are divided by the remainder
Such as:
$expr 2 + 1
Results: 3
$expr 5-3
Results: 2
If an argument for expr is a variable, then the variable name is replaced by the variable value before the expression is calculated.
您可能关注的文档
- HTTP 1.1 状态码与它们的用途(国外英语资料).doc
- Http Status Codehttp响应状态码(国外英语资料).doc
- HTTP 连接自动重定向到 HTTPS 连接(国外英语资料).doc
- HX-5000数字化可寻址校园智能广播方案(国外英语资料).doc
- H_一对多(国外英语资料).doc
- IBM T60笔记本重装系统找不到硬盘解决办法(国外英语资料).doc
- i9100_如何识别(国外英语资料).doc
- IBM笔记本开机出错代码及解决办法(国外英语资料).doc
- ICD2使用中常见问题汇总_毛狼的博客(国外英语资料).doc
- IC卡接口芯片TDA8007的读写器设计(国外英语资料).doc
文档评论(0)