Changeset 578
- Timestamp:
- 12/22/2011 15:34:47 (5 months ago)
- File:
-
- 1 edited
-
trunk/libfiledb.sh.in (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/libfiledb.sh.in
r577 r578 31 31 # 32 32 # The on-disk storage format uses the tab character as the field delimiter 33 # and the new line character as the record delimiter. Tab characters are 34 # accepted in keys and values. 33 # and the new line character as the record delimiter. Tab characters and 34 # new lines are accepted in both keys and values and recorded as "\t" and 35 # "\n" respectively. 35 36 36 37 # Purpose: Load a filedb into an array … … 54 55 local IFS=" " 55 56 while read -r key value; do 56 eval "`echo "${array}"`[ `echo -e "${key}"`]=`echo -e "${value}"`"57 eval "`echo "${array}"`[\"`echo -e "${key}"`\"]=\"`echo -e "${value}"`\"" 57 58 done <"${filedb}" && 58 59 return 0 … … 75 76 76 77 local i 78 local line 77 79 local key 78 80 local value … … 81 83 [ -v "${array}" ] && 82 84 eval 'for i in "'"\${!${array}"'[@]}"; do 83 echo "${i}" 84 done' | while read key; do 85 eval 'value="'"\${${array}[${key}]}"'"' 85 i="${i//\\/\\\\}" 86 i="${i// 87 /\\n}" 88 echo -E "${i}" 89 done' | while read -r key; do 90 eval 'value="'"\${${array}["'"'${key}'"]}"' 91 value="${value//\\/\\\\}" 92 value="${value// 93 /\\n}" 86 94 echo -nE "${key%% *}" 87 95 while [ "${key}" != "${key#* }" ]; do
Note: See TracChangeset
for help on using the changeset viewer.
