25 lines
517 B
Bash
Executable File
25 lines
517 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [[ -z $1 ]]; then
|
|
echo First argument must be a csv containing: jobs,hours
|
|
exit
|
|
fi
|
|
|
|
if [[ -z $2 ]]; then
|
|
echo Second argument must be the name of who you are billing
|
|
exit
|
|
fi
|
|
|
|
|
|
TMP=$(mktemp)
|
|
cat $1 | awk -F, '{ sum += $2 }; { print $1 ";" $2 ";" $2 * 50 } END { print "Total" ";" sum ";" sum * 50}' > $TMP
|
|
|
|
# Last line
|
|
# Everything but the last line
|
|
TOTAL=$(cat $TMP | tail -n 1) \
|
|
BODY=$(cat $TMP | head -n -1) \
|
|
COMPANY=$2 \
|
|
envsubst < template.mm | groff -t -mm -T pdf > output.pdf
|
|
|
|
rm $TMP
|