- [ "${length%%[1-9]*}" -o "${width%%[1-9]*}" -o "${height%%[1-9]*}" = 0 ] \
- && read -r length width height discard <<-EOF
- $(meta_line "$file"; echo Rereading meta for "$file" >&2)
- EOF
- [ "${tags%%tags=*}" ] && tags='tags=';
- [ "${comment%%comment=*}" ] && comment='comment='
+
+ if [ ! "$deltags" ]; then
+ extags="$(printf '%s' "$newtags" |tr , '\n' |grep -e "^-" |cut -d: -f1 )"
+ tags="$(UNSTRING "${tags#tags=}" |tr , '\n' |grep -vwFe "$extags")"
+ if printf %s "$extags" |grep -vq :; then
+ tags="$(printf %s\\n "$tags" |grep -vE '^-[^:]+$')"
+ fi
+ tags="$(printf '%s\n' "${tags},${newtags}" \
+ | tr , '\n' |sort -u |tr '\n' , \
+ | STRING)"
+ else
+ tags="$(UNSTRING "${tags#tags=}" |tr , '\n')"
+ detag="${deltags},"; while [ "$detag" ]; do
+ tags="$(printf '%s\n' "$tags" |grep -vxFe "${detag%%,*}")"
+ detag="${detag#*,}"
+ done
+ tags="$(printf '%s\n' "$tags" |sort -u |tr '\n' , |STRING)"
+ fi
+ tags="${tags#,}"; tags="${tags%,}"