【发布时间】:2011-01-18 20:17:06
【问题描述】:
bash 脚本的正确缩进是什么?作为一个 java/c++ 猴子,我虔诚地缩进我的代码。但似乎你不能缩进这段代码:
#! /bin/bash
if [ $# = 0 ]
then
# there was no arguments => just do to standard output.
echo "there are no parameters"
else
cat << EOF
==========================================================
==========================================================
==========================================================
==========================================================
DESCRIPTION:
$1
----------------------------------------------------------
EOF
fi
缩进时它不识别 EOF,如果你只是取消缩进 EOF(混淆)它打印缩进。
问: bash 脚本的正确缩进是什么?
【问题讨论】:
-
大多数具有 HEREDOC 的编程语言都存在缩进问题。这并不是 bash 所特有的。
标签: bash unix scripting indentation