I'm using Python and Pandas to write multiple bash scripts. I have a pandas.Series containing the script. Simplified::
script = pd.Series([
'#!/bin/bash',
'#SBATCH --output "/home/path/output_filename.out"'
])
I then use script.to_csv('script_file.bat',index=False)
to create the file.
The output file looks like this:
#!/bin/bash
"#SBATCH --output ""/home/path/output_filename.out"""
I have tried all the suggestions here Python - Using quotation marks inside quotation marks (triple quotes, single and double quotes (as shown in the example) , escaping the quotemarks), as well as making the quoted text a variable, but none works.