This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: cygwin bash script suddenly can't find ls, grep

On Tue, Oct 14, 2014 at 10:54 PM, LMH <> wrote:
> Thorsten Kampe wrote:
>> * LMH (Sat, 11 Oct 2014 20:30:07 -0400)
>>> Good Lord, I guess I wasn't thinking very clearly trying to use
>>> PATH as
>>> a variable for something else. I changed to,
>>> FILE_DIR=$(ls -d './'$SET'/'$FOLD'/'$FOLD'_anneal/'$PARAM_SET'/'$AN_SET)
>>> echo $FILE_DIR
>>> FILE_LIST=($(ls $FILE_DIR'/'*'out.txt' ))
>>> echo ${FILE_LIST[@]}
>> That looks pretty ugly. You probably can replace all that with
>> FILE_LIST=(./$SET/$FOLD/$FOLD_anneal/$PARAM_SET/$AN_SET/*out.txt)

More suggestions:

1. use lowercase variable names for variables used only inside your
script. Since variable names are case insensitive it will avoid
collisions like this and also improve readability of the code.
2. In bash you can set shell option "nullglob" to avoid a one element
array with the glob pattern if there is no matching file. In zsh it's
"setopt NULL_GLOB" I believe.
3. Since we do not know whether there are spaces in variables I would
replace the line above with (including suggestion 1):


Kind regards


[guy, jim].each {|him| remember.him do |as, often| as.you_can - without end}

Problem reports:
Unsubscribe info:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]