qqz2="123"
echo "input:"
read qqz
if
test $qqz -eq $qqz2
then
echo "hello"
fi
有点问题:为什么 代码写成
代码: 全选
if test $qqz -eq $qqz2 then
代码: 全选
if [test $qqz -eq $qqz2] then
在if语句里,什么情况下 写成 if [条件] then 呢?
代码: 全选
if test $qqz -eq $qqz2 then
代码: 全选
if [test $qqz -eq $qqz2] then
代码: 全选
>> help if
if: if COMMANDS; then COMMANDS; [ elif COMMANDS; then COMMANDS; ]... [ else COMMANDS; ] fi
Execute commands based on conditional.
The `if COMMANDS' list is executed. If its exit status is zero, then the
`then COMMANDS' list is executed. Otherwise, each `elif COMMANDS' list is
executed in turn, and if its exit status is zero, the corresponding
`then COMMANDS' list is executed and the if command completes. Otherwise,
the `else COMMANDS' list is executed, if present. The exit status of the
entire construct is the exit status of the last command executed, or zero
if no condition tested true.
Exit Status:
Returns the status of the last command executed.
代码: 全选
] ls -ld //