bug-bash
[Top][All Lists]
Advanced

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

for i in ... doesn't seem to work. bash bug?


From: Navin
Subject: for i in ... doesn't seem to work. bash bug?
Date: Wed, 23 Jan 2002 18:42:30 +1100

Hello people 

I am a newbie to linux but am comfortable with some shell programming.

I am using bash-2.05-15mdk and bash-completion-20020115-1 and Mandrake 8.1

This is extract from the _cd() section of the /etc/bash_completion

for i in ${CDPATH//:/ }; do
        echo i = $i
        # create an array of matched subdirs
        dirs=( $( compgen -d $i/$cur ) )
        # add subdirs to list of completions as necessary
        [ ${#dirs[@]} ] && COMPREPLY=( ${COMPREPLY[@]} ${dirs[@]#$i/})
done


The echo $i after the for loop gives me an output of 
i = . /home/navin /usr/java /home/navin/work/wsa_work/WSA



but when I copy the whole _cd() section into a local file and try to run the 
script the echo $i section gives me
i = .
i = /home/navin
i = /usr/java
i = /home/navin/work/wsa_work/WSA



Could u tell me if this is a bash bug or should I report this to 
bash_completion, if separate, list. I tried to modify the code to do first 
take the output into a variable and then do the for i in ... but it still 
doesn't work. I have not found a workaround yet.

Thanks very much

Navin






reply via email to

[Prev in Thread] Current Thread [Next in Thread]