【发布时间】:2021-12-29 09:38:27
【问题描述】:
我有一个在 Ubuntu 虚拟机上运行良好的工作脚本。我最近切换到 MacOS,在尝试运行相同的脚本时出现以下错误:
danyateran@MacBook-Air-Danya:~/restorator$ ./restorator.sh -V
/Users/danyateran/restorator/bin/functions.sh: line 1568: syntax error near unexpected token `>'
/Users/danyateran/restorator/bin/functions.sh: line 1568: ` ssh_conn "${SOURCE_SERVERNAME}" 'exec 2>&1; whmapi1 fetch_ssl_certificates_for_fqdns domains='${ssl_host}'; exit' &>> "${TMP_TRANSFER_DIR}/ssl_info_${ssl_host}.txt"'
虽然语法看起来不错,而且据我所知 MacOS 与 Linux 具有相同的行尾,但我不知道可能出了什么问题。非常感谢任何意见。
【问题讨论】:
-
您可以通过在每行的开头放置四个空格来正确格式化代码。或者对内联代码使用反引号:`code` 变为
code。
标签: linux bash macos shell script