/usr/share/cb2bib/c2btools/ris2bib is in cb2bib 1.9.7-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | #!/bin/sh
#-------------------------------------------------------------------------------
# ris2bib -- Script to convert RIS format to BibTeX
# cb2Bib Tools
#
# Copyright (C) 2005-2017 by Pere Constans
# constans@molspaces.com
#
# Improvements and modifications:
# Copyright (C) 2009 by Filippo Rusconi
# rusconi@mnhn.fr
#
# May/June 2009:
# - Added checks to ensure that the used commands are available on
# system.
# - Make use of mktemp to create a temp directory.
#
# See LICENSE file that comes with this distribution
#
# Usage: ris2bib input_ris output_bib
#-------------------------------------------------------------------------------
# Using ris2xml and xml2bib utilities from:
# http://bibutils.refbase.org/
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
# Init variables
#-------------------------------------------------------------------------------
# Modify accordingly
#ris2xml=/usr/local/bin/ris2xml
#xml2bib=/usr/local/bin/xml2bib
ris2xml=ris2xml
xml2bib=xml2bib
ris2xml_flags="-u"
xml2bib_flags="-sd -b"
#-------------------------------------------------------------------------------
# Immediately check that the needed programs are there:
"${ris2xml}" --version > /dev/null 2>&1
if [ "$?" != "0" ]
then
echo "Program ris2xml (suite bibutils) is required."
echo "Set it in your path, and/or modify $0 accordingly."
echo "Ending processing."
exit 1
fi
"${xml2bib}" --version > /dev/null 2>&1
if [ "$?" != "0" ]
then
echo "Program xml2bib (suite bibutils) is required."
echo "Set it in your path, and/or modify $0 accordingly."
echo "Ending processing."
exit 1
fi
# Make sure we trap errors (we put that after the tests above because
# we need the tests to fail, in case, without exiting immediately).
set -e
# Getting filenames from command line
echo "cb2Bib Tools: Script to convert RIS format to BibTeX"
echo ""
echo "It uses external package bibutils from"
echo "http://bibutils.refbase.org/"
echo ""
if test "$#" != 2; then
cat <<EOF
Usage: $0 input_ris output_bib
EOF
exit 2
fi
# Create temporary directory
# Note that we use the mktemp utility that ensures that
# we do not overwrite any preexisting directory
tmp_dir=$(mktemp -d --tmpdir c2b_tools_tmp.XXXXXXXX)
# Setting files
ris="$1"
bib="$2"
work_dir="$PWD"
# Preparing temporary files
cp "$ris" "${tmp_dir}"/c2b_tmp.ris
cp "$ris" "${tmp_dir}"/c2b_tmp.bib
# bibutils procedure
cd "${tmp_dir}"
"${ris2xml}" ${ris2xml_flags} c2b_tmp.ris > c2b_tmp.xml
"${xml2bib}" ${xml2bib_flags} c2b_tmp.xml | sed 's%^ISSUE=%NUMBER=%g' > c2b_tmp.bib
# Clean up
cd "${work_dir}"
cp "${tmp_dir}"/c2b_tmp.bib "$bib"
rm -rf "${tmp_dir}"
echo ""
echo "$0 ended."
|