This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: cygwin bash script suddenly can't find ls, grep
- From: LMH <lmh_users-groups at molconn dot com>
- To: cygwin at cygwin dot com
- Date: Sat, 11 Oct 2014 20:30:07 -0400
- Subject: Re: cygwin bash script suddenly can't find ls, grep
- Authentication-results: sourceware.org; auth=none
- References: <5439C59F dot 5060308 at molconn dot com> <5439C8A6 dot 5020605 at cornell dot edu>
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