I have a python script (a.py) that calls a shell script(b.sh). b.sh is responsible for updating a conf file through sed.
Here is a sample call.
b.sh -s hello
will save hello in the conf file via an sed command and hello is passed as a parameter to shellscript using python.
It is implemented in a way that a service calls the a.py file using the commands module(py2). Which in turn calls the shell script b.sh.
Now I want to save some input that has backticks and looks like below
strpart1strpart2
I cannot escape this because the call is made by python and as soon as backtick hits shell it happens like this
Q1) Can anything be done during call on shell to escape backticks without breaking the string.
Now to avoid breaking, I wrote a py2 replace method.
The problem is that when I have to supply an input like below, escaping the backtick.
str`example
It is saved as it is.
However, if I supply input like
it is saved as
I would like to save it as it is
without causing a split on console.
What do I change in python so that the backslashes don’t get saved, I have also tried replacing backslashes with (‘) still the same result. With python, the escape character is also getting saved.