On Dec 11, 2007 8:17 AM, Peter Volkov <[EMAIL PROTECTED]> wrote: > Hello. > > Some eclasses (kernel-2, font) use variable to pass space separated PATH > to patch or fontconfig files from ebuild to eclass. In ebuild we use: > > FONT_CONF="path1 path2" > > Then eclasses use the variable: > > for conffile in ${FONT_CONF}; do > ... > done > > The problem with this doesn't work if path{1,2} contain spaces. The > solution I'm thinking about is to you arrays: > > FONT_CONF=("path1" "path2") > > for conffile in "[EMAIL PROTECTED]"; do > ... > done > > But is this good idea? Are there better? > > -- > Peter. >
I agree using arrays would be much better, you can also loop through the arrays like. for ((i=0;i<${#FONT_CONF[*]};i++)); do echo "${FONT_CONF[i]}"; done this way you can avoid spacing because you'll just be calling each array element in order using quotes. Fernando