I have a script that bumps a version of a package.json. I can bump the version with this script, but I'm having problems printing a variable, where I'm expecting "1.2.3", but get "1 2 3".
#!/bin/bash
# Split string by '.'
IFS='.'
read -r -a array <<< "1.1.3"
array[1]=$((array[1]+1))
VERSION="${array[0]}.${array[1]}.${array[2]}"
echo $VERSION
# 1 2 3
VERSION=`printf "%i.%i.%i" "${array[0]}" "${array[1]}" "${array[2]}"`
echo $VERSION
# 1 2 3
echo $(jq -r '.version = "'"$VERSION"'" ' package.json)
# packaje.json -> "version": "1 2 3"
What am I missing here?