Hello,
I am trying to create a shell script that use command block (don�t really know if this is the correct way to say it), but while one version works fine, the other one is not working at all.
So let me show an example of this "command block" I�m using and its working ok:
cat << _EOF_
`echo "All informations regarding Brand Split log. It is in order regardless it shows no date."`
`echo`
`echo "Activations:"`
`grep "^8:Mass40s --" brand_split_file`
`grep "^9:Mass --" brand_split_file`
`grep "^10:Mass Promo --" brand_split_file`
`grep "^11:Jovem --" brand_split_file`
`grep "^12:Corporate --" brand_split_file`
`grep "^13:VIP --" brand_split_file`
_EOF_
This next one is not working:
monday=`awk -F";" '{print$1}' tmp |sort -u |tail -7 |head -1`
echo $monday
cat << _EOF_
`echo "Deletion by SC on $monday"`
`echo "Mass40s : `awk -F";" '$1=="'$monday'" && $4==44' tmp |wc -l`"`
`echo "Mass : `awk -F";" '$1=="'$monday'" && $4==4' tmp |wc -l`"`
`echo "Mass Promo : `awk -F";" '$1=="'$monday'" && $4==3' tmp |wc -l`"`
`echo "Jovem : `awk -F";" '$1=="'$monday'" && $4==42' tmp |wc -l`"`
`echo "Corporate : `awk -F";" '$1=="'$monday'" && $4==6' tmp |wc -l`"`
`echo "VIP : `awk -F";" '$1=="'$monday'" && $4==5' tmp |wc -l`"`
`echo "Prestigio : `awk -F";" '$1=="'$monday'" && $4==48' tmp |wc -l`"`
`echo "Reactivation : `awk -F";" '$1=="'$monday'" && $4==46' tmp |wc -l`"`
`echo "Postpaid : `awk -F";" '$1=="'$monday'" && $4==1' tmp |wc -l`"`
`echo "T+ Employee : `awk -F";" '$1=="'$monday'" && $4==10' tmp |wc -l`"`
`echo "Stock : `awk -F";" '$1=="'$monday'" && $4==18' tmp |wc -l`"`
`echo "Paris : `awk -F";" '$1=="'$monday'" && $4==40' tmp |wc -l`"`
`echo "Boston : `awk -F";" '$1=="'$monday'" && $4==41' tmp |wc -l`"`
`echo "Sal : `awk -F";" '$1=="'$monday'" && $4==43' tmp |wc -l`"`
`echo "TC101 : `awk -F";" '$1=="'$monday'" && $4==101' tmp |wc -l`"`
`echo "TC102 : `awk -F";" '$1=="'$monday'" && $4==102' tmp |wc -l`"`
`echo "TC106 : `awk -F";" '$1=="'$monday'" && $4==106' tmp |wc -l`"`
_EOF_
This is the error output:
./the_script: command substitution: line 1: unexpected EOF while looking for matching `"'
./the_script: command substitution: line 2: syntax error: unexpected end of file
./the_script: command substitution: line 1: unexpected EOF while looking for matching `"'
./the_script: command substitution: line 2: syntax error: unexpected end of file
If you compare the two codes you will notice that while the first code has only one command ( grep ), the second has two ( echo first, and then awk ), so I�m guessing that is the problem... which is strange because if I use the `caracters` it is supose to accecpt it like a command. I have others scripts that use this.
So if you could give me a hint on how to solve this, I would be very gratefull. I'm kind on a hurry, since I making a series of script to run automatically during my well earned vacations.... (about to go crazy with all this work!)
Thank you guys!