Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ionen-angewandte-physik
AG-Wester
bibtools
Commits
5f9aaa3c
Commit
5f9aaa3c
authored
Apr 04, 2022
by
User expired
Browse files
newbib: Per default make a backup of the bibtex file
parent
d2c0aa4e
Pipeline
#69989
failed with stage
in 45 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
bin/newbib
bin/newbib
+11
-0
bin/newbibpdf
bin/newbibpdf
+11
-0
No files found.
bin/newbib
View file @
5f9aaa3c
...
...
@@ -9,6 +9,7 @@ USAGE: $(basename $0) [target_dir] bibfiles
'target_dir' must be an existing directory.
Options:
-h print this help
-b do not make backup files with suffix '.bak'
-n show changes only (basic formatting is applied)
-f full instead of abbreviated journal names
-u do not change field contents
...
...
@@ -21,6 +22,7 @@ if [ $# -lt 1 ]; then usage 1; fi
targetdir
=
.
# Default options.
BACKUP
=
1
# Make a backup copy with suffix '.bak'.
DRYRUN
=
""
# No dry run option for bib-* tools.
ACTION
=
"eval"
# Execute commands (no dry run).
FULLNAME
=
""
# Use long journal names.
...
...
@@ -31,6 +33,8 @@ SKIPJABBR="" # Journal may not be abbreviated.
for
arg
;
do
# With option '-h' print usage and exit.
if
[[
"
$arg
"
==
"-h"
]]
;
then
usage 0
;
fi
# With option '-b' do not make a backup file.
if
[[
"
$arg
"
==
"-b"
]]
;
then
BACKUP
=
0
;
fi
# With option '-n' only print changes/actions.
if
[[
"
$arg
"
==
"-n"
]]
;
then
DRYRUN
=
"-n"
...
...
@@ -53,6 +57,7 @@ fi
for
bibfile
in
"
$@
"
do
# Skip options.
test
"
$bibfile
"
!=
"-b"
||
continue
test
"
$bibfile
"
!=
"-n"
||
continue
test
"
$bibfile
"
!=
"-f"
||
continue
test
"
$bibfile
"
!=
"-u"
||
continue
...
...
@@ -71,6 +76,12 @@ do
continue
}
# Create a backup copy with suffix '.bak'.
if
[
$BACKUP
-eq
1
]
then
cp
-a
"
${
bibfile
}
"
"
${
bibfile
}
.bak"
fi
# Apply basic formatting for dry run.
if
[
-n
"
$DRYRUN
"
]
then
...
...
bin/newbibpdf
View file @
5f9aaa3c
...
...
@@ -10,6 +10,7 @@ If unspecified, files that are unique by suffix are chosen.
The 'target_dir' must be an existing directory.
Options:
-h print this help
-b do not make backup files with suffix '.bak'
-n show changes only (basic formatting is applied)
-f full instead of abbreviated journal names
-u do not change field contents
...
...
@@ -24,6 +25,7 @@ EOF
TARGETDIR
=
new_lit
# Default options.
BACKUP
=
1
# Make a backup copy with suffix '.bak'.
DRYRUN
=
""
# No dry run option for bib-* tools.
ACTION
=
"eval"
# Execute commands (no dry run).
FULLNAME
=
""
# Use long journal names.
...
...
@@ -35,6 +37,8 @@ SKIPJABBR="" # Journal may not be abbreviated.
for
arg
;
do
# With option '-h' print usage and exit.
if
[[
"
$arg
"
==
"-h"
]]
;
then
usage 0
;
fi
# With option '-b' do not make a backup file.
if
[[
"
$arg
"
==
"-b"
]]
;
then
BACKUP
=
0
;
fi
# With option '-n' only print changes/actions.
if
[[
"
$arg
"
==
"-n"
]]
;
then
DRYRUN
=
"-n"
...
...
@@ -59,6 +63,7 @@ fi
for
arg
do
# Skip options.
test
"
$arg
"
!=
"-b"
||
continue
test
"
$arg
"
!=
"-n"
||
continue
test
"
$arg
"
!=
"-f"
||
continue
test
"
$arg
"
!=
"-u"
||
continue
...
...
@@ -179,6 +184,12 @@ then
exit
1
fi
>
/dev/stderr
# Create a backup copy with suffix '.bak'.
if
[
$BACKUP
-eq
1
]
then
cp
-a
"
${
BIBFILE
}
"
"
${
BIBFILE
}
.bak"
fi
# Apply basic formatting for dry run.
if
[
-n
"
$DRYRUN
"
]
then
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment