delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/10/12/05:00:55

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
q=dns; s=default; b=Bvio5+PrHsxvf8+AtqAzGoxzI78MxeXudw2+U/1YVel
6jhfmjDcsijHiy44PFxasqTVI9y9+VfrzCawu2no1ucDPLfX0crwLs75bKQMyvRH
uG1XgTdWloa7lBGmJKxqbYtgbr0C8jhM8V/mdmqbhXmpCYCDWbxMeSMmCzPLqbN4
=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:message-id:date:from:mime-version:to:subject
:references:in-reply-to:content-type:content-transfer-encoding;
s=default; bh=4XWCID0I76L8P3waR9VpeaJEjFY=; b=GVZEe3D8/oQZO6Sn8
Qpxrt1XNX+xFSe09wlGta94lMRq6uHY6u79kX20omT69ePv3MDoUk6cL1l73o9hs
cFEgnysYWsjG0Fqr5L64Ptaxewf5JJ7a2WMArYYOHaR2b+G71zlYET0uBF82VPer
aAed8ZXicgPZMP2/MjgCpyvBo0=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2
X-HELO: smtp101.biz.mail.bf1.yahoo.com
X-Yahoo-SMTP: ycweUreswBCK.d0cygTP5tXwHncbOU7YVeVfIxOQoyRMI2IuIKLmUqE-
Message-ID: <5439CB8F.9000708@molconn.com>
Date: Sat, 11 Oct 2014 20:30:07 -0400
From: LMH <lmh_users-groups AT molconn DOT com>
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:29.0) Gecko/20100101 Firefox/29.0 SeaMonkey/2.26.1
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: cygwin bash script suddenly can't find ls, grep
References: <5439C59F DOT 5060308 AT molconn DOT com> <5439C8A6 DOT 5020605 AT cornell DOT edu>
In-Reply-To: <5439C8A6.5020605@cornell.edu>
X-IsSubscribed: yes


Ken Brown wrote:
> On 10/11/2014 8:04 PM, LMH wrote:
>> Hello,
>>
>> I have been working on a bash script and suddenly I started getting an
>> error that ls could not be found,
>>
>> ./remove_rows.sh: line 27: ls: command not found
>>
>> I can run ls from the command line just fine. There is also an ls
>> command before line 27 that runs fine. This is the part of the script
>> that is causing problems (line numbers are included).
>>
>> 24 PATH=$(ls -d './'$SET'/'$FOLD'/'$FOLD'_anneal/'$PARAM_SET'/'$AN_SET)
>> 25 echo $PATH
>> 26
>> 27 FILE_LIST=($(ls $PATH'/'*'out.txt'))
>> 28 echo ${FILE_LIST[@]}
>>
>> The echo $PATH command gives the correct output, but I get the error on
>> line 27. I have tried without the double parentheses, which wouldn't
>> give the result I want,
>>
>> FILE_LIST=$(ls $PATH'/'*'out.txt')
>>
>> but this gives the same error.
>>
>> After this problem happened, I updated cygwin and restarted, but the
>> issue persists. Is there something wrong with my cygwin install? If
>> there happens to be some problem with my bash, please let me know, but
>> this is pretty simple stuff and I just can't see why ls would be found
>> at line 24 but not line 27.
> 
> You've changed PATH in line 24.  Is 'ls' still in it?
> 
> Ken

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[@]}

and everything is fine. I guess it was a bash issue after all. Thanks
for checking that out.

LMH




--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019