Bash 在此处缩排文档
示例
您可以在此处的带有标签的文档内缩排文本,需要使用<<-重定向运算符而不是<<:
$ cat <<- EOF
This is some content indented with tabs `\t`.
You cannot indent with spaces you __have__ to use tabs.
Bash will remove empty space before these lines.
__Note__: Be sure to replace spaces with tabs when copying this example.
EOF
This is some content indented with tabs _\t_.
You cannot indent with spaces you __have__ to use tabs.
Bash will remove empty space before these lines.
__Note__: Be sure to replace spaces with tabs when copying this example.这样的一个实际用例(如所述manbash)在shell脚本中,例如:
if cond; then
cat <<- EOF
hello
there
EOF
fi通常,如本if语句所述,在代码块内缩进行,以提高可读性。没有<<-运算符语法,我们将被迫编写上述代码,如下所示:
if cond; then
cat << EOF
hello
there
EOF
fi读起来很不愉快,而且在更复杂的现实脚本中情况变得更糟。
热门推荐
1 训练狗狗憋尿
2 狗狗追踪训练
3 狗狗训练要多少钱
5 深圳狗狗训练
6 训练狗狗唤回
7 狗狗叫怎么训练
8 狗狗训练班
10 狗狗社会化训练
11 狗狗叫回训练
12 广州狗狗训练学校
13 狗狗训练躺下
14 狗狗随行训练
15 训练狗狗巡回
16 狗狗要怎么训练
17 狗狗喂食训练
18 训练狗狗躺下