I'm looking to write some tests that will create and execute a bash script. Bash itself has a nice way to do this:
% cat > run.sh << EOF
> echo "I ran this"
> EOF
% . run.sh
I ran this
In Python I can do this:
with open ('run.sh', 'w') as rsh:
rsh.write('echo "I ran this"\n')
-- etc ---
This is fine for a short script in Python, but I'm wondering if there is some technique I don't know about that let's me do something like what I can do in bash.