From: Wilo <wi...@gm...> - 2010-03-08 03:35:19
|
Hi everyone, I've recently upgraded a development server to eXist version 1.4, and am now struggling to rewrite all my admin shell scripts, which have broken as a result. In particular, I'm trying to work around the change in the output format. With version 1.2, I could use the command: [code] echo "xmldb:get-child-collections('/db')" | bin/client.sh -u admin -P password -x 2>/dev/null | tail -n +6 [/code] to get a list of the collections in eXist. These would be returned separated by line breaks, and I could simply: [code] collections=$(echo "xmldb:get-child-collections('/db')" | bin/client.sh -u admin -P password -x 2>/dev/null | tail -n +6) for i in $collections; do echo $i done [/code] [output] collection1 collection2 system [/output] However, eXist 1.4 returns all the collections on one line, all run together and with no means of separating them (same command): [output] collection1collection2system [/output] The best work-around I've come up with this morning is: [code] collections=`echo -e "for \$item in xmldb:get-child-collections('/db')\n return concat(\$item,'|')" | bin/client.sh -u admin -P password -x` for i in $(echo $collections | sed 's/|/\n/g'); do echo $i done [/code] but it's pretty ugly. As a sysadmin I'm only really concerned with making sure the contents of the server are dumped cleanly and reliably, so that I can back them up remotely. Is there any chance the original behaviour could be restored? My eXist-related scripts are already the most difficult of all my server scripts to maintain. What do other sysadmins who have to struggle with eXist do? Grateful for any input, Wilo |