mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-08 05:24:39 +01:00
32 lines
432 B
Bash
32 lines
432 B
Bash
|
#!/bin/sh
|
||
|
|
||
|
set -e -u
|
||
|
|
||
|
CONNNAME=""
|
||
|
|
||
|
usage() {
|
||
|
echo "usage: $0 [--connname <s>]"
|
||
|
}
|
||
|
|
||
|
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
|
||
|
|