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.