nnnotes/rrref.sh

60 lines
917 B
Bash
Raw Normal View History

2014-08-20 14:53:58 +02:00
#!/bin/bash
WHERE=$( cd $(dirname $0) ; pwd -P )
# default configs
if [[ -e "$WHERE/CONFIG" ]]; then
source $WHERE/CONFIG
fi
2014-08-20 19:14:40 +02:00
OUT=txt # defaults to txt output
2014-08-20 14:53:58 +02:00
OPTIND=1 #reset getopts
while getopts :b:r:o: opts; do
case $opts in
b)
BIB=$OPTARG
;;
r)
REF=$OPTARG
;;
o)
OUT=$OPTARG
;;
?)
echo "invalid option -$OPTARG";
exit;
;;
:)
echo "option -$OPTARG requires an argument";
exit;
;;
esac
done
shift $((OPTIND-1))
# bibliographe's path set?
if [[ -z "$BIBLIOGRAPHE_PATH" ]]; then
echo "No bibliographe";
exit;
fi
# bibliography exists?
if [[ -z "$BIB" ]]; then
echo "No bibliography"
exit;
fi
# referebce exists?
if [[ -z "$REF" ]]; then
echo "No reference"
exit;
fi
2016-03-14 15:47:30 +01:00
./parse/refactorbib.py $BIB > tmpbib.json
2014-08-20 14:53:58 +02:00
REFERENCE=$(node $BIBLIOGRAPHE_PATH/generatebib.js --data tmpbib.json --items [\"$REF\"] --output $OUT)
echo $REFERENCE
rm tmpbib.json