rdiff: add extra sanity check for keep parameter

This commit is contained in:
Jerome Charaoui 2021-01-06 11:33:58 -05:00
parent db7daa3d59
commit e017810941

View File

@ -159,6 +159,11 @@ case $desttype in
* ) fatal "desttype '$desttype' is neither local nor remote" ;;
esac
# check keep parameter format
if [ "$keep" != "yes" ] && ! echo "$keep" | grep -qe '^[0-9]\+[smhDWMY]\?$'; then
fatal "Keep parameter contains an invalid value ($keep)."
fi
### REMOVE OLD BACKUPS ###
if [ "$keep" != yes ]; then