forked from extern/zfs-auto-snapshot
Implement --prefix parameter checking.
Also add -p to the getopt list of short options.
This commit is contained in:
parent
4c14da4130
commit
f7ceb28963
@ -194,7 +194,7 @@ GETOPT=$(getopt \
|
|||||||
--longoptions=default-exclude,dry-run,skip-scrub,recursive \
|
--longoptions=default-exclude,dry-run,skip-scrub,recursive \
|
||||||
--longoptions=keep:,label:,prefix:,sep: \
|
--longoptions=keep:,label:,prefix:,sep: \
|
||||||
--longoptions=debug,help,quiet,syslog,verbose \
|
--longoptions=debug,help,quiet,syslog,verbose \
|
||||||
--options=dnshl:k:rs:qgv \
|
--options=dnshl:k:p:rs:qgv \
|
||||||
-- "$@" ) \
|
-- "$@" ) \
|
||||||
|| exit 1
|
|| exit 1
|
||||||
|
|
||||||
@ -239,8 +239,19 @@ do
|
|||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
(-p|--prefix)
|
(-p|--prefix)
|
||||||
# @TODO: Parameter validation. See --sep below for the regex.
|
|
||||||
opt_prefix="$2"
|
opt_prefix="$2"
|
||||||
|
while test "${#opt_prefix}" -gt '0'
|
||||||
|
do
|
||||||
|
case $opt_prefix in
|
||||||
|
([![:alnum:]_-.:\ ]*)
|
||||||
|
print_log error "The $1 parameter must be alphanumeric."
|
||||||
|
exit 44
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
opt_prefix="${opt_prefix#?}"
|
||||||
|
done
|
||||||
|
opt_prefix="$2"
|
||||||
|
shift 2
|
||||||
;;
|
;;
|
||||||
(-q|--quiet)
|
(-q|--quiet)
|
||||||
opt_debug=''
|
opt_debug=''
|
||||||
|
Loading…
Reference in New Issue
Block a user