mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-30 10:26:58 +01:00
32 lines
443 B
Bash
Executable file
32 lines
443 B
Bash
Executable file
#!/bin/sh
|
|
|
|
set -e -u
|
|
|
|
CONNNAME=""
|
|
|
|
usage() {
|
|
echo "usage: $0 [--connname <s>]"
|
|
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
|
|
|