我尝试使用 if 语句,但这不起作用,因为 tee 命令有两个括号,一个在开头,一个在结尾。
我尝试了类似的方法,但也没有用
if [[ "$logging" == "yes" ]]; then
ftpt="2>&1 | tee $ftpLF"
else
ftpt=""
fi
} "$ftpt"
错误:
./ftp.sh: line 149: syntax error near unexpected token `"$ftpt"'
./ftp.sh: line 149: `} "$ftpt"'
我现在使用它,但我没有打开/关闭它的选项,它总是打开
{
....commands....
} 2>&1 | tee "$ftpLF"