X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=functions.sh;h=4b3013d1ca07333c32589bac60d16adfc1c768d5;hb=45351df2bc9832d4ce2f9ee6a2b19370236e89a8;hp=85e9dd93848db98caf437e78206ceda6419a8625;hpb=971e83d17061d018822181d7ce7353f818b8fe7f;p=carnet-tools-cn.git diff --git a/functions.sh b/functions.sh index 85e9dd9..4b3013d 100644 --- a/functions.sh +++ b/functions.sh @@ -191,6 +191,9 @@ cp_backup_conffile() { cp_check_and_sed() { [ "$CP_SCRIPT_DEBUG" ] && set -vx local s sedcmd grepret ret i + if [ -z "$3" ]; then + return 1 + fi s="$1" shift sedcmd="$1" @@ -205,7 +208,7 @@ cp_check_and_sed() { fi [ -h "$i" ] && i=$(readlink -f "$i") sed "$sedcmd" "$i" > "$i.dpkg-tmp" - if [ ! "$?" = "0" ]; then + if [ $? -ne 0 ]; then rm "$i.dpkg-tmp" echo "cp_check_and_sed: Problem with sed" 1>&2 return 5 @@ -217,7 +220,7 @@ cp_check_and_sed() { fi ret=0 done - [ "$ret" -eq 2 -a "$grepret"] && ret=1 || true + [ "$ret" -eq 2 -a "$grepret" ] && ret=1 || true return $ret }