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

Bash-specific features

In addition to all the POSIX shell script features in the previous section, Bash adds many extensions that make programming more convenient, expressive, and sometimes less error-prone. These include:

  • Named array variables. This is perhaps the most important advantage over the plain POSIX shell script. It makes many otherwise impractical things possible. If you need one single reason to use Bash, this is probably it!
  • An easier syntax for performing conditional tests. This is also a very important feature.
  • Extended globs for advanced pattern-matching.
  • Regular expression support, for performing the most powerful kind of text-pattern-matching, when even globs won't do.
  • Local variables for functions, a limited kind of variable scope.
  • A C-style for loop syntax.
  • Several kinds of parameter expansion, including case transformation, array slices, substrings, substitution, and quoting.
  • Arithmetic expressions, for conveniently testing the outcome of arithmetic operations.
  • Many more shell options to control shell script and interactive shell behavior, including extra debugging support.
  • Better support for irregular filenames and unusual line separators in data.

All of these features are also discussed in this book. Where relevant, we will specify which features are POSIX-specific and which features are specific to Bash.

主站蜘蛛池模板: 黎川县| 手游| 民乐县| 安庆市| 莎车县| 吉安县| 平武县| 松桃| 肇东市| 周宁县| 阆中市| 女性| 泗阳县| 什邡市| 镇雄县| 砚山县| 剑河县| 嘉祥县| 封丘县| 汉川市| 赣州市| 黄浦区| 临猗县| 黄陵县| 永川市| 开平市| 朝阳区| 宣威市| 延川县| 扶风县| 靖西县| 杭州市| 霍州市| 锦屏县| 子长县| 夏津县| 石景山区| 丰都县| 土默特右旗| 宁夏| 宁德市|