bash json
by kzo81 from LinuxQuestions.org on (#6E7MJ)
Hi Folks,
Could you please help me out with this?
Code:CONFIG="config.json"
NOW=$(date +"%Y-%m-%dT%H:%M:%S%:z")
jq '.sync_started = "$NOW"' "$CONFIG" | sponge "$CONFIG" || exit 3I dont know how to run the date command inside jq to modify the value.
this is my json:
Code:{
"mount_point": "/mnt/storage",
"mounted": false,
"rsync": "ongoing",
"sync_started": "$NOW",
"sync_ended": ""
}
Could you please help me out with this?
Code:CONFIG="config.json"
NOW=$(date +"%Y-%m-%dT%H:%M:%S%:z")
jq '.sync_started = "$NOW"' "$CONFIG" | sponge "$CONFIG" || exit 3I dont know how to run the date command inside jq to modify the value.
this is my json:
Code:{
"mount_point": "/mnt/storage",
"mounted": false,
"rsync": "ongoing",
"sync_started": "$NOW",
"sync_ended": ""
}