--snip-- [23] /usr/share/config/colors/Kst [24] Colors Enter command (help to show menu) > q --snip-- is file: /usr/share/config/colors/._cfg0000_Kst Colors Broken code is: find_targets() { local dir targets for dir in $(config_protect_dirs ) ; do [[ -d ${dir} ]] || continue find ${dir} -iname '._cfg????_*' | \ sed -e 's,^\(.*\)\._cfg...._\(.*\),\1\2,g' | sort -u done } do_list() { targets=( $(find_targets ) ) write_list_start "Configuration files needing action:" if [[ ${#targets[@]} > 0 ]] ; then write_numbered_list "${targets[@]}" else write_kv_list_entry "No out of date files found" fi } Any ideas how to come around that whitespace problem?
this should work: do_list() { targets=( $(find_targets ) ) write_list_start "Configuration files needing action:" if [[ ${#targets[@]} > 0 ]] ; then targets = `echo ${targets[@]} | sed -e 's/ /\\ /'` write_numbered_list "${targets}" else write_kv_list_entry "No out of date files found" fi }
Sorry, above isn't correct. Spaces should be escaped in find_targets: find_targets() { local dir targets for dir in $(config_protect_dirs ) ; do [[ -d ${dir} ]] || continue find ${dir} -iname '._cfg????_*' | \ sed -e 's,^\(.*\)\._cfg...._\(.*\),\1\2,g' | sort -u | sed -e 's/ /\\ /g' done } hope it works
Nope, doesn't work. I thought about this already. If it worked, i wouldn't have opened this BUG ;-) --snip-- [22] /etc/udev/scripts/cdsymlinks.sh [23] /usr/share/config/colors/Kst\ [24] Colors --snip-- I guess I need to update the 'write_numbered_list' function to watch out for escaped spaces...
Fixed with following patch as of r155. --- libs/output.bash.in (revision 154) +++ libs/output.bash.in (working copy) @@ -89,6 +89,10 @@ while [[ ${#@} -gt 0 ]] ; do item=${1} shift + if [[ ${item##*\\} == "" ]] ; then + item="${item%\\} ${1}" + shift + fi write_numbered_list_entry "${n}" "${item}" n=$(( ${n} + 1 )) done ###