diff options
| author | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-06-28 19:03:01 +0900 |
|---|---|---|
| committer | TheSiahxyz <164138827+TheSiahxyz@users.noreply.github.com> | 2025-06-28 19:03:01 +0900 |
| commit | cbd1d349a511da7a861540a5d6ea954d4d06871b (patch) | |
| tree | 92b932d351a9474e7fd0f12c6c973274daaaa0d9 /ar/.local/bin/getbib | |
| parent | 74cb5de14fc06fe97b6fc306f6176f7d6b467b6b (diff) | |
updates
Diffstat (limited to 'ar/.local/bin/getbib')
| -rwxr-xr-x | ar/.local/bin/getbib | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/ar/.local/bin/getbib b/ar/.local/bin/getbib index c90d864..1eb0731 100755 --- a/ar/.local/bin/getbib +++ b/ar/.local/bin/getbib @@ -1,10 +1,10 @@ #!/bin/sh -BIB_FILE="${HOME}/latex/uni.bib" -[ -f "${BIB_FILE}" ] || BIB_FILE="${2:-$(find "${HOME}" -path "${HOME}/.*" \ +bib_file="${HOME}/latex/uni.bib" +[ -f "${bib_file}" ] || bib_file="${2:-$(find "${HOME}" -path "${HOME}/.*" \ -prune -o -type "f" -name "*.bib" -print -quit)}" -{ [ -f "${BIB_FILE}" ] || [ "${2}" ]; } || { +{ [ -f "${bib_file}" ] || [ "${2}" ]; } || { printf "%s\n" "Create a .bib file or provide as \$2." && exit "1" } @@ -50,11 +50,11 @@ doi2bib() { return "1" } - grep -iFq "doi = {${doi}}" "${BIB_FILE}" 2>"/dev/null" && { + grep -iFq "doi = {${doi}}" "${bib_file}" 2>"/dev/null" && { printf "%s\n" "Bibtex entry for DOI: ${doi} already exists in the file." } || { - [ -s "${BIB_FILE}" ] && printf "\n" >>"${BIB_FILE}" - printf "%s\n" "${entry}" >>"${BIB_FILE}" + [ -s "${bib_file}" ] && printf "\n" >>"${bib_file}" + printf "%s\n" "${entry}" >>"${bib_file}" printf "%s\n" "Added bibtex entry for DOI: ${doi}" } } |
