May-08-2019, 04:40 PM
(This post was last modified: May-08-2019, 04:41 PM by Gribouillis.)
You could do it directly in python instead of using /bin/sh
#!/pythonsh import subprocess import sys with open('ligand') as infile: ligand = infile.read().strip().split() for nvar in ligand: subprocess.call([ sys.executable, "./prepare_ligand4.py", "-l", nvar + ".mol2", "-o", nvar + ".pbdqt" ])Alternately, if you're ready to change /bin/sh for /bin/bash, here is a way to delegate the work to python
#!/bin/bash read -r -d '' somecode <<EOF import subprocess import sys with open('ligand') as infile: ligand = infile.read().strip().split() for nvar in ligand: subprocess.call([ sys.executable, "./prepare_ligand4.py", "-l", nvar + ".mol2", "-o", nvar + ".pbdqt" ]) EOF /pythonsh -c "$somecode"I don't know how to do the same for /bin/sh . Everything is so much simpler in python!