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

Re: BASH Scripting Question



On 11/25/05, Metrics <the.metric@gmail.com> wrote:
> Hi all,
>
> Can someone explain to me the following behaviour? I have this script
>
> #!/bin/sh
>
> LISTS=('debian-user' 'security-basics' 'hostap' 'pen-test' 'ntbugtraq' 'ion-general' 'vim' 'madwifi');
> LIST_COUNT=${#LISTS}
> echo $LIST_COUNT
>
> for ((i=0;i<$LIST_COUNT-1;i++)); do
>         echo /home/bhillis/Maildir/.${LISTS[${i}]}/
> done

11 is the length of the string 'debian-user'.

LIST_COUNT=$((${#LISTS[*]}+1))

will give you the right number.



Reply to: