Created
June 26, 2025 20:02
-
-
Save bradmartin333/d524ca4516ac0cc9a934de7ea9110c68 to your computer and use it in GitHub Desktop.
update file with jq
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Check if an argument is provided | |
if [ -z "$1" ]; then | |
echo "Usage: $0 <bitrate>" | |
exit 1 | |
fi | |
# Store the original settings.json | |
mv settings.json settings_orig.json | |
# Use jq with --arg to pass the first CLI argument ($1) as the bitrate | |
# This safely passes the shell variable into the jq expression. | |
jq --arg bitrate "$1" '.Rushes.Bitrate = ($bitrate | tonumber)' settings_orig.json > settings.json | |
# Remove the original settings file | |
rm settings_orig.json | |
echo "Bitrate updated to $1 in settings.json" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment