linux查看bash pro,Pro Bash Programming : Scripting the GNU/Linux Shell

Chapter 5 Summary

By far the largest subject in this chapter is parameter expansion, and by far the largest section of parameter expansion is devoted to those expansions that were introduced by the KornShell and incorporated into the standard Unix shell. These are tools that give the POSIX shell much of its power. The examples given in this chapter are relatively simple; the full potential of parameter expansion will be shown as you develop serious programs later in the book.

Next in importance are arrays. Though not part of the POSIX standard, they add a great deal of functionality to the shell by making it possible to collect data in logical units.

Understanding the scope of variables can save a lot of head scratching, and well-named variables make a program more understandable and maintainable.

Manipulating the positional parameters is a minor but important aspect of shell programming, and the examples given in this chapter will be revisited and expanded upon later in the book.

Commands

declare: Declares variables and sets their attributes

eval: Expands arguments and executes the resulting command

export: Places variables into the environment so that they are available to child processes

shift: Deletes and renumbers positional parameters

shopt: Sets shell options

unset: Removes a variable entirely

Concepts

Environment: A collection of variables inherited from the calling program and passed to child processes

Array variables: Variables that contain more than one value and accessed using a subscript

Scalar variables: Variables that contain a single value

Associative arrays: Array variables whose subscript is a string rather than an integer

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值