I've written a small bash script for work: I'm trying to update a file automatically based on the metadata.
Overall, the script works fine, but anytime I save a new version I get the error:
egrep: parentheses not balanced
If I rewrite the line that begins HOSTEDDATE=, using the exact same syntax, it works again. I suspect it has something to do with the quotation marks which seem to change in appearance (perfectly vertical when first typed, angled after being re-saved as a new version).
Since I'm using plain text in TextEdit, is this a known issue? Is there a workaround that doesn't involve me re-writing the same line over and over again?
The relevant portion of the code is below:
for PIURL in ${ARRAY[*]}
do
HOSTEDDATE=`cURL -s ${PIURL} | strings | egrep -o "CreationDate\(D:[0-9]{6}" | egrep -o "[0-9]{6}"`
FILE=${PIURL##*/}
NAME=${FILE%.*}
#find local file and pull date
LOCALDATE=`ls $NAME* | egrep -o "[0-9]{6}"`
if [[ ${HOSTEDDATE} > ${LOCALDATE} ]]; then
#move old file to "ARCHIVED"
mv $NAME* ARCHIVED/
#download PI file with required name
cURL -L -o ${NAME}_${HOSTEDDATE}.pdf $PIURL
#send e-mail with
mail -s "${NAME} has a new PI" [email protected] <<< "${NAME}_${DATE} has been uploaded to Pulse"
fi
done


TextEdit>Preferences>Smart quotes (checkbox)as well (or restricted to rich text format).