This I need quotes in a cronjob which I am creating through a chef recipe but even though I escape the quotes they do not appear in the cronjob which is created.
bash "Add cron" do
user root
group root
code <<-EOH
(
(crontab -l; echo "5 0 * * * /bin/find #{node['user']['dir']}/files/ -type f \\( -name \"*.csv\" -o -name \"*.csv.bad\" -o -name \"*.ctrl\" \\) -mtime +1 -print0 | xargs -0 gzip -f" ) | crontab -
)
EOH
end
just to clarify the cron job I want to end up with should contain -name "*.csv"
but what I actually get is -name *.csv
bash "Add cron" do
user "root"
group "root"
code <<-EOH
(
(crontab -l; echo -e '5 0 * * * /bin/find /home/root/files/ -type f \\( -name \"*.csv\" -o -name \"*.csv.bad\" -o -name \"*.ctrl\" \\) -mtime +1 -print0 | xargs -0 gzip -f'
)
EOH
end
Use single quote instead of double here.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.