File: flip_symbol.sh

package info (click to toggle)
beancounter 0.8.8
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 360 kB
  • ctags: 142
  • sloc: perl: 2,592; sh: 744; makefile: 144
file content (14 lines) | stat: -rwxr-xr-x 316 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/bin/sh

if [ $# -ne 2 ]
then
    echo "Usage: $0 from_symbol to_symbol"
    echo "Updates beancounter tables replacing the former with the latter."
    exit 1
fi

for table in stockprices stockinfo portfolio indices
do
    echo "update $table set symbol='$2' where symbol='$1';" | \
	psql -e -d beancounter 
done