summaryrefslogtreecommitdiff
path: root/contrib/scripts/entry
blob: cc030d8ea4de419c0120b554e4c2beb65273fa93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh

if [ -z "$LEDGER" -o ! -r "$LEDGER" ]; then
   echo Please set your LEDGER environment variable.
fi

line=`wc -l $LEDGER | awk '{print $1}'`

if ledger entry "$@" > /tmp/entry; then
   cat /tmp/entry >> $LEDGER
else
   echo "$@" >> $LEDGER
fi
rm /tmp/entry

vi +$line $LEDGER