Regex 使用正则表达式检查cron条目';05***/usr/bin/aide——检查和#x27;
如何使用正则表达式检查cron条目Regex 使用正则表达式检查cron条目';05***/usr/bin/aide——检查和#x27;,regex,rspec,serverspec,inspec,Regex,Rspec,Serverspec,Inspec,如何使用正则表达式检查cron条目05***/usr/bin/aide--check?我想在Chef InSpec登记一下 its('content') { should match /<the regular expression>/ } its('content'){应该匹配//} 正则表达式可以是/05***\/usr\/bin\/aide--check/ describe cron do it { expect(subject).to have_entry '0 5 *
05***/usr/bin/aide--check
?我想在Chef InSpec登记一下
its('content') { should match /<the regular expression>/ }
its('content'){应该匹配//}
正则表达式可以是/05***\/usr\/bin\/aide--check/
describe cron do
it { expect(subject).to have_entry '0 5 * * * /usr/bin/aide --check' }
end
是在Serverspec中执行此操作的正确方法,它还将立即解决格式化问题
如果您真的想使用regexp(并且您的后续注释作为答案暗示您不想使用),那么您可以这样做:
its(:content) { is_expected.to match %r{0 5 \* \* \* /usr/bin/aide --check} }
是否可能重复并转义星号?