c3d2-web/scripts/generate-news-list.sh

21 lines
277 B
Bash
Executable File

#!/usr/bin/env bash
# prevent output of "$1/*.xml" as file
# if the target directory is empty
shopt -s nullglob
cd $1
cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<newsfiles>
EOF
for item in *.xml ; do
echo " <file>${item}</file>"
done
cat <<EOF
</newsfiles>
EOF