On Tuesday 11 December 2007 08:17:12 Peter Volkov wrote: > 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?
FONT_CONF=path1:path2 IFS=. for for conffile in ${FONT_CONF}; do .... done unset IFS Or if you want to be really picky about preserving IFS if you can't make it local in a function SIFS=${IFS-y} OIFS=${IFS} IFS=. for for conffile in ${FONT_CONF}; do .... done if [ "${SIFS}" = "y" ]; then unset IFS else IFS=${OIFS} fi That way you work the same way as the classic $PATH variable. But of course no one cares as it's Just Not Bash (tm) Thanks Roy -- [EMAIL PROTECTED] mailing list