I'm trying to write a backup and restore function for automation.
I'm struggling to populate the dictionary with path information.
Here's a snippet from the backup function.
FILE="path/to/file"
BASENAME=$(basename $FILE)
key="$BASENAME"
value="$FILE"
test_dict[$key]=$value
echo ${test_dict[*]}
I get this
bash: package.json: syntax error: invalid arithmetic operator (error token is ".json")
This is my first bash script and I'm not really fussed about what storage type I'm using, be it array, dictionary, etc... all I care about is to keep track of which file belongs where.
This is my first bash script so sorry if this is a trivial question/error on my side.
I'd really appreciate your input on this.
Cheers :)
Edit: test_dict is declared with:
declare -a test_dict