xwords/xwords4/relay/scripts/showmsgs.sh

33 lines
443 B
Bash
Raw Normal View History

#!/bin/sh
set -e -u
CONNNAME=""
usage() {
echo "usage: $0 [--connname <s>]"
2011-12-07 03:50:04 +01:00
exit 1
}
while [ $# -gt 0 ]; do
case $1 in
--connname)
CONNNAME=$2
shift
;;
*) usage
;;
esac
shift
done
QUERY="SELECT * from msgs"
if [ -n "$CONNNAME" ]; then
QUERY="$QUERY WHERE CONNNAME='$CONNNAME'"
fi
QUERY="$QUERY ORDER BY ctime DESC"
echo "${QUERY};" | psql xwgames