25 lines
681 B
Bash
Executable File
25 lines
681 B
Bash
Executable File
#!/bin/sh
|
|
|
|
# error handler
|
|
exit_if_error() {
|
|
local exit_code=$1
|
|
shift
|
|
[[ $exit_code ]] && # do nothing if no error code passed
|
|
((exit_code != 0)) && { # do nothing if error code is 0
|
|
printf 'ERROR: %s\n' "$@" >&2 # we can use better logging here
|
|
exit "$exit_code" # we could also check to make sure
|
|
# error code is numeric when passed
|
|
}
|
|
}
|
|
|
|
echo '==== Write html blog ===='
|
|
|
|
perl log2html.pl>index.html
|
|
exit_if_error $? "Writing failed"
|
|
echo 'Done.'
|
|
|
|
echo '==== End of writing ===='
|
|
|
|
echo '==== Adding html in the commit ===='
|
|
git add --verbose index.html
|
|
echo '==== End of commit ====' |