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

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.

主站蜘蛛池模板: 依兰县| 钦州市| 西林县| 河北省| 贵溪市| 余江县| 保山市| 南澳县| 新野县| 五大连池市| 定远县| 正宁县| 淄博市| 汕尾市| 仪征市| 苗栗县| 桃园市| 天镇县| 乌拉特前旗| 泗水县| 嵊州市| 泸州市| 永定县| 漳浦县| 稷山县| 修文县| 宜兰市| 徐闻县| 通渭县| 南安市| 平罗县| 团风县| 江北区| 桐柏县| 桐乡市| 洞口县| 循化| 湖北省| 吕梁市| 图木舒克市| 辉县市|