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

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.

主站蜘蛛池模板: 江都市| 三门峡市| 玉环县| 济阳县| 昔阳县| 玛多县| 苍山县| 灌南县| 乡宁县| 湛江市| 双辽市| 怀化市| 辽中县| 衡东县| 南安市| 沐川县| 江华| 郁南县| 正镶白旗| 博客| 阳谷县| 太白县| 东乡| 青浦区| 凤凰县| 拉孜县| 福州市| 鄄城县| 宁南县| 泸水县| 那曲县| 江津市| 珠海市| 朝阳市| 亳州市| 五寨县| 和田县| 梁平县| 句容市| 安塞县| 秭归县|