[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Strange Bash Script Problem



On Sun, 11 Aug 2019 at 23:18, Stephen P. Molnar <s.molnar@sbcglobal.net> wrote:
>
> I am running an up-to-date installation of Buster on my Linux platform
> and have run into a strange problem with a bash script.

[...]

> for d in $(cat ligand.list)

This line is the problem, it is vulnerable to various kinds
of breakage and is therefore bad practice, see here:
http://mywiki.wooledge.org/DontReadLinesWithFor

Try this instead, it is the recommended practice and
it may well solve your \r issue:

#!/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


Reply to: