Last active
June 13, 2022 13:29
-
-
Save ajaxray/5314953f3818a890fce72b74c1c44f08 to your computer and use it in GitHub Desktop.
Shell script to update a yaml configuration using sed
This file contains 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
echo "Replacing FB Access Token" | |
echo "--------------------\n" | |
# Displaying old value for reference | |
echo "### Old configuration" | |
grep ' access_token:' config.yml | |
echo "### New configuration" | |
echo " access_token: \"$1\"" | |
sed -i "" "s/^\s+access_token: .*$/ access_token: \"${1}\"/" config.yml | |
echo "\nDone.\n" |
Can it be done without providing any input argument and the set value would be embedded?
could you please share the config.yml file for reference
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a shell script to update yaml configuration using sed tool.
It's replacing value of
access_token
inconfig.yml
in current directory as example.The configuration key and file path should be adjusted according to your scenario.
How to use