On 08/12/2019 09:39 AM, Greg Wooledge wrote:
On Sun, Aug 11, 2019 at 02:10:06PM -0400, Stephen P. Molnar wrote:
Thanks to all that shared their expertise.
#!/bin/bash
while IFS= read -r d
do
cd "${d}_apo-3k9b"
echo "${d}_apo-3k9b"
echo "${d}_apo-3k9b.dpf"
/home/comp/Apps/Autodock/autodock4 -p "${d}_apo-3k9b.dpf" -l
"${d}_apo-3k9b.dlg"
cd ..
done <ligand.list
and dos2unix solved the problem!!!!!!
There's still one more problem you want to fix: the exit status of cd
isn't being checked. If the cd fails, your script still continues on
to run the two echo commands and the autodock4 command. I don't know
what autodock4 does, but running it in the wrong directory is probably
not helpful.
Here's how I would solve that (there are other ways too):
#!/bin/bash
while IFS= read -r d
do
( cd "${d}_apo-3k9b" || exit
echo "${d}_apo-3k9b"
echo "${d}_apo-3k9b.dpf"
exec /home/comp/Apps/Autodock/autodock4 -p "${d}_apo-3k9b.dpf" -l
"${d}_apo-3k9b.dlg"
)
done <ligand.list
P.S. it would also have been possible to work around the carriage return
issues with IFS, but your dos2unix approach is perfectly valid as well.
Many thanks for the update. I checked it and it works perfectly.
--
Stephen P. Molnar, Ph.D. Life is a fuzzy set
http://www.Molecular-Modeling.net Multivariate and stochastic
614.312.7528 (c)
Skype: smolnar1