Here are the details of my setup. I have the following files:
config.json
{
"paths": ["/Users/First Folder", "/Users/Second Folder"]
}
test.sh
#!/bin/zsh
monitored_paths=$(jq -r '.paths[]' config.json)
fswatch --verbose "${monitored_paths[@]}"
The paths
key in the JSON array needs to be processed by jq
and then expanded as arguments. However, when executing test.sh
, I encounter this output:
Output:
start_monitor: Adding path: /Users/First Folder
/Users/Second Folder
My expectation is to have:
start_monitor: Adding path: /Users/First Folder
start_monitor: Adding path: /Users/Second Folder
In summary, I aim to monitor two files, but it seems only one file is being monitored. How can I resolve this issue?
EDIT:
Used exact output by request in the comments.