File: hxcite-mkbib

package info (click to toggle)
html-xml-utils 6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,620 kB
  • sloc: ansic: 10,027; sh: 2,135; lex: 189; yacc: 125; perl: 123; makefile: 122
file content (42 lines) | stat: -rwxr-xr-x 976 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
#
# Script that combines the functions of cite and mkbib
#
# Copyright  1994-2000 World Wide Web Consortium
# See http://www.w3.org/Consortium/Legal/copyright-software
#
# Author: Bert Bos <bert@w3.org>
# Created: 29 Mar 2000
# Version: $Id: hxcite-mkbib,v 1.1 2008/08/17 14:00:21 bbos Exp $

USAGE="Usage: cite-mkbib [-b base] [-p pattern] [-s sep] bibfile [file]"

AUX=${TMPDIR:-/tmp}/cm1-$$
TMP=${TMPDIR:-/tmp}/cm2-$$
trap "rm $AUX $TMP 2>/dev/null" 0


# usage -- print usage message and exit
usage () { echo "$USAGE" >&2; exit 2; }



# Parse command line
while [ $# -ne 0 ]; do
  case "$1" in
    -b) base="-b '$2'"; shift 2;;
    -p) pattern="-p '$2'"; shift 2;;
    -s) sep="-s '$2'"; shift 2;;
    -*) usage;;
    --) shift; break;;
    *) break;
  esac
done
if [ $# -lt 1 -o $# -gt 2 ]; then usage; fi
bibfile="$1"
shift

# Call cite and mkbib
eval cite "$base" "$pattern" -a $AUX "'$bibfile'" "$@" >$TMP &&
eval mkbib "$sep" -a $AUX "'$bibfile'" $TMP