所以我有一个单行 bash 命令来检查目录是否存在。如果是,它会 git pull,如果不是,它会克隆存储库。我在我的 Windows 机器上运行 Cygwin,当我在 Cygwin 中运行此命令时,它运行良好:
if [ -d C:/repo ]; then cd C:/repo && "C:/Program Files (x86)/Git/bin/git.exe" pull; else "C:/Program Files (x86)/Git/bin/git.exe" clone -b develop https://repo.git C:/repo; fi
当我像这样从 Puppet 运行相同的命令时:
exec {'checkout repository':
command => "if [ -d C:/repo ]; then cd C:/repo && "C:/Program Files (x86)/Git/bin/git.exe" pull; else "C:/Program Files (x86)/Git/bin/git.exe" clone -b develop https://repo.git C:/repo; fi"
}
我得到错误:
错误:'如果 [ -d C:/repo ]; 然后 cd C:/repo && "C:/Program Files (x86)/Git/bin/git.exe" pull; else "C:/Program Files (x86)/Git/bin/git.exe" clone -b develop https://repo.git C:/repo; fi' 不合格且未指定路径。请限定命令或指定路径。
任何想法为什么?