我正在尝试为 vagrant puppet dev env 创建一个简单的 bash shell 脚本配置程序,它检查 /tmp/puppet-modules-up-to-date 是否存在并且是在某个时间范围内创建的,准确地说是 14 天。我正在努力使用这个简单的脚本。任何帮助表示赞赏。
#!/bin/bash
if [[ ! -f /tmp/.puppet-modules-up-to-date ]] && [[ ! (find /tmp/.puppet-modules-up-to-date -mtime -14 | grep puppet) ]]; then
puppet_dir=/etc/puppet
echo 'Copying Puppetfile into place'
cp /vagrant/puppet/Puppetfile $puppet_dir
cd $puppet_dir
echo 'Installing puppet modules into place'
librarian-puppet install
echo 'Updating previously installed puppet modules'
librarian-puppet update
touch /tmp/.puppet-modules-up-to-date
fi
简单地给我以下错误:
==> default: /tmp/vagrant-shell: line 3: conditional binary operator expected
==> default: /tmp/vagrant-shell: line 3: expected `)'
==> default: /tmp/vagrant-shell: line 3: syntax error near `/tmp/.puppet-modules-up-to-date'
==> default: /tmp/vagrant-shell: line 3: `if [[ ! -f /tmp/.puppet-modules-up-to-date ]] && [[ ! (find /tmp/.puppet-modules-up-to-date -mtime -14 | grep puppet) ]]; then'