indeed GazL, the busybox is running sh rather than bash - i only now realise too.
In the end I set aside the idea of lists. I was looking for lists thinking that they are more dynamic. But then again in bash arrays are dynamic too. so no reason to look for lists (too much C programming I guess).
here is what I have, using arrays in the end (as David1357 suggested)...
Code:
#!/bin/sh
USERS_DIR="/share/MD0_DATA/"
cd $USERS_DIR
FOLDER_LIST=( $( ls -d1 * | grep -v "\*$" ) )
#echo "FOLDER_LIST items = ${#FOLDER_LIST[@]}"
#echo "FOLDER LIST wc = " `ls -dA1 * | wc -l`
USERS_LIST=( $( cat /etc/passwd | cut -d":" -f1 ) )
#echo "USERS_LIST items = ${#USERS_LIST[@]}"
for (( INDEX = 0 ; INDEX < ${#FOLDER_LIST[@]} ; INDEX++ )) ; do
echo "FOLDER_LIST[$INDEX]=${FOLDER_LIST[$INDEX]}"
for (( i = 0 ; i < ${#USERS_LIST[@]} ; i++ )) ; do
echo "USERS_LIST[$i]=${USERS_LIST[$i]}"
if [[ "${FOLDER_LIST[$INDEX]}" == "${USERS_LIST[$i]}" ]] ; then
echo "found a match ${FOLDER_LIST[$INDEX]} is matched to ${USERS_LIST[$i]}"
fi
done
done
the two lists are working 'fine'. as in the array cells get filed up almost as expected (exception: in FOLDER_LIST the 'network recycle bin' folder is perceived as 3 different elements but its OK for now.)
thank you all for your help
Goodnight