While attempting to write a simple bash script to help with my deployment process, I ran in to a confusing error:
#!/bin/bash
WEEKDAY=$(date +'%u')
echo $WEEKDAY
DAYS_TO_WEDNESDAY=$((3-$WEEKDAY))
echo $DAYS_TO_WEDNESDAY
Results in:
1
")syntax error: invalid arithmetic operator (error token is "
The strangest part of it is that I could swear that this very script ran perfectly well some days ago.
EDIT (14:58):
The issue was not with the bash script, but with using SVN through TortoiseSVN. The detour through Windows changed EOL markers to "CR LF", which result in syntax errors in bash. Setting svn:eol-style -property helps avoid further similar issues.