Copy BibTex entry from command line #3030
-
Is it possible to copy the BibTex entry from command line, starting from the citation key? I would like to run something like:
and get
to stdout (which I can then pipe to the clipboard). I would use this to manually populate the .bib file of a Quarto document (I don't like the visual editor due to this bug) |
Beta Was this translation helpful? Give feedback.
Answered by
retorquere
Oct 21, 2024
Replies: 2 comments 2 replies
-
Yes:
|
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
raffaem
-
Just sharing what I came up with to add a bibliography entry to a bibliography file from the command line: #!/usr/bin/env bash
# zotcit bibliography.bib CITATIONKEY
if [ ! -f "$1" ]; then
touch "$1"
fi
grep "$2" "$1"
if [ "$?" -eq 1 ]; then
CIT=$(curl "http://localhost:23119/better-bibtex/export/item?citationKeys=$2&translator=bib" 2>/dev/null)
if [ "$CIT" = "no items found" ]; then
echo "ERROR: Not a valid citation key"
exit 1
fi
echo "Adding citation to bibliography file"
echo -e "\n" >> "$1"
echo "$CIT" >> "$1"
else
echo "Citation already present in bibliography file"
fi |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes: