summaryrefslogtreecommitdiff
path: root/scripts/entry
blob: 28daf8c8b0d0db68b3b3a6f90629240e15e00680 (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