By default xmlstarlet does not include a final newline on the output. Because POSIX says that all lines must end in a newline, this causes the final line of output to be skipped by the 'while read ...' loop in bash. Adding a '-n' after the '-v ...' causes xmlstarlet to include a final newline at the end of its output.
Signed-off-by: Jon DeVree <n...@vault24.org> --- trojans/csd-post.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trojans/csd-post.sh b/trojans/csd-post.sh index 3c3cc397..86837d2b 100755 --- a/trojans/csd-post.sh +++ b/trojans/csd-post.sh @@ -95,7 +95,7 @@ fi if [ -n "$XMLSTARLET" ]; then URL="https://$CSD_HOSTNAME/CACHE/sdesktop/data.xml" - curl $PINNEDPUBKEY -s "$URL" | xmlstarlet sel -t -v '/data/hostscan/field/@value' | while read -r ENTRY; do + curl $PINNEDPUBKEY -s "$URL" | xmlstarlet sel -t -v '/data/hostscan/field/@value' -n | while read -r ENTRY; do # XX: How are ' and , characters escaped in this? TYPE="$(sed "s/^'\(.*\)','\(.*\)','\(.*\)'$/\1/" <<< "$ENTRY")" NAME="$(sed "s/^'\(.*\)','\(.*\)','\(.*\)'$/\2/" <<< "$ENTRY")" -- 2.43.0 _______________________________________________ openconnect-devel mailing list openconnect-devel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/openconnect-devel