I run a script which stores a value in a variable like this:
secret=`aws secretsmanager get-secret-value --secret-id <secretid> --region eu-west-1|grep SecretString|awk -F" '{print $4}'`
Now I have a file called env-list which has an entry like this:
secret=
I want to redirect the output of first command to paste after = sign in env-list file, so that my env-file holds the secret value from first command: secret=value.
I am struggling a lot with this.
Advertisement
Answer
sed -i "s/^secret=.*/secret=$secret/g" env-list