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

  • Bash Quick Start Guide
  • Tom Ryder
  • 155字
  • 2021-07-23 16:58:56

Quoting

The way you can reliably include characters that are special to Bash literally in a command line is to quote them. Quoting special characters makes Bash ignore any special meaning they may otherwise have to the shell, and instead use them as plain characters, like a-z or 0-9. This works for almost any special character.

We say "almost", because there's one exception: there's no way to escape the null character (ASCII NUL, 0x00) in a shell word.

Quoting is the most important thing that even experienced people who write shell script sometimes get wrong. Even a lot of very popular documentation online fails to quote correctly in example scripts! If you learn to quote correctly, you will save yourself a lot of trouble down the line. The way quoting in shell script works very often surprises people coming from other programming languages.

We will look at three kinds of quoting: escaping, single-quoting, and double-quoting.

主站蜘蛛池模板: 乡城县| 神农架林区| 朝阳县| 阳曲县| 兴和县| 信阳市| 贵定县| 专栏| 洛隆县| 东丰县| 古丈县| 五莲县| 蓝田县| 永善县| 东乡县| 阳曲县| 卓尼县| 太保市| 葫芦岛市| 广饶县| 威信县| 黔南| 伊川县| 毕节市| 刚察县| 张家川| 阿瓦提县| 龙胜| 新丰县| 稷山县| 宜兰县| 黄平县| 蒙阴县| 教育| 苍溪县| 双城市| 甘孜县| 鹰潭市| 舞阳县| 望奎县| 巴塘县|