Hi.
Its OK, I found the solution. You need to double up the escape characters for it to work.
Thanks
Hamza Khan-Cheema
Hi
I am trying to get a bash script to work that has a sed command in it. The sed
command has escape characters in it. For some reason Chef seems to be taking
these escape characters out and trying to execute the sed script which fails.
The sed script works in the console
Below is the original test script I made. This works as expected.
if [ $(grep -c postrotate $1) -ne 0 ]; then
if [ $(grep -c checksum_log.sh $1) -ne 1 ]; then
sed -i 's/endscript/\/usr\/bin\/checksum_log.sh $1\n endscript/' $1
fi
fi
The Bash script block in Chef is the same as above contained within a <<-EOF
block with $1 being replaced with a file name.
The error in chef is concerning the sed command itself.
Is there any special escaping I need to do?
Thanks.
Kind Regards
Hamza Khan-Cheema
Archive powered by MHonArc 2.6.16.