Failed if $1 not set

Because we use set -u, this helper failed if the optional arg is not set
This commit is contained in:
Maniack Crudelis 2017-03-13 23:29:47 +01:00 committed by GitHub
parent 12b223b2f5
commit f2e656176e

View file

@ -10,7 +10,7 @@
#
# It's possible to use this helper several times, each config will added to same logrotate config file.
ynh_use_logrotate () {
if [ -n "$1" ]; then
if [ "$#" -gt 0 ]; then
if [ "$(echo ${1##*.})" == "log" ]; then # Keep only the extension to check if it's a logfile
logfile=$1 # In this case, focus logrotate on the logfile
else