literal string has a $ in front of it. How can I ignore it?
by aristosv from LinuxQuestions.org on (#5GKDZ)
In a .json file, I am trying to replace the literal string $max_open_trades with a value that I have stored in the $max_open_trades variable. Unfortunately both have the same name, and even worst the literal sting has a $ in front of it.
Code:sed -i -e "s/$max_open_trades/$max_open_trades/g" /root/freqtrade_USDT/test/config.jsonObviously when using double quotes the shell tries to expand both variables and when using single quotes none of the variables are expanded.
Attachment 36109
Using sed, is there a way to consider the first instance of $max_open_trades as a literal string and the second as a variable to be expanded?
I don't know maybe I'm thinking about it all wrong, any suggestions are welcome.
Thanks
Attached Thumbnails


Code:sed -i -e "s/$max_open_trades/$max_open_trades/g" /root/freqtrade_USDT/test/config.jsonObviously when using double quotes the shell tries to expand both variables and when using single quotes none of the variables are expanded.
Attachment 36109
Using sed, is there a way to consider the first instance of $max_open_trades as a literal string and the second as a variable to be expanded?
I don't know maybe I'm thinking about it all wrong, any suggestions are welcome.
Thanks
Attached Thumbnails