Article 6E7MJ bash json

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": ""
}
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments