I have a bash script that loops over a set of files, and replaces a string, in each file, with a version number.
#!/bin/bash
ANGULAR_APP_VERSION=6.6.6
echo $ANGULAR_APP_VERSION
declare -a arr=(
"test1.txt"
"test2.txt"
)
for i in "${arr[@]}"
do
sed 's/"@@BUILD_VERSION@@"/"'$ANGULAR_APP_VERSION'"/g' ${arr[$i]}
done
Everytime I run the script, it generates the following error:
./test1.txt: syntax error: operand expected (error token is "./test1.txt")
I don't understand why it is wrong. The files exist.