$OpenBSD$
--- bibdb.orig	Sun Aug 21 14:08:06 2011
+++ bibdb	Fri Oct 19 11:56:27 2012
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # bibdb
 #
@@ -127,18 +127,18 @@ case $ext in
     #-------
     # case of a .xml file: write our own .aux file from <xref> tags
     xml )
-        echo "\\relax" > $auxfile
+        printf "%s\n" "\\relax" > $auxfile
         # write the \citation{} commands
         for cite in `awk -F "linkend=\"" '/<citation><xref linkend=\"/ { print $2 }' $file | cut -f1 -d"\""`
           do
-          echo "\\citation{$cite}" >> $auxfile
+          printf "%s\n" "\\citation{$cite}" >> $auxfile
         done
         # write the \bibstyle{} command
-        echo "\\bibstyle{dbalpha}" >> $auxfile
+        printf "%s\n" "\\bibstyle{dbalpha}" >> $auxfile
 
         # write the \bibdata{} command
         # look for .bib files in the current directory
-        printf "\\\bibdata{" >> $auxfile
+        printf "%s\n" "\\bibdata{" >> $auxfile
         # first counting pass
         n=0; for bib in `ls *.bib | sed s/.bib//g`; do let "n+=1"; done
         # second pass actually writes
@@ -157,16 +157,16 @@ case $ext in
     #-------
     # case of a BibTeX .bib file: write our own .aux file from the entries
     bib )
-        echo "\\relax" > $auxfile
+        printf "%s\n" "\\relax" > $auxfile
         # write the \citation{} commands
         for cite in `awk -F { '/@[A-Za-z]*{/ { print $2 }' $file | cut -f1 -d,`
         do
-          echo "\\citation{$cite}" >> $auxfile
+          printf "%s\n" "\\citation{$cite}" >> $auxfile
         done
         # write the \bibstyle{} command
-        echo "\\bibstyle{dbalpha$version}" >> $auxfile
+        printf "%s\n" "\\bibstyle{dbalpha$version}" >> $auxfile
         # write the \bibdata{} command
-        echo "\\bibdata{`echo \"$file\" | sed s/.bib//g`}" >> $auxfile;;
+        printf "%s\n" "\\bibdata{`echo \"$file\" | sed s/.bib//g`}" >> $auxfile;;
 
     #-------
     # unknown extension
