mirror of
https://github.com/notwa/rc
synced 2024-06-30 19:07:11 -07:00
improve interval check
This commit is contained in:
parent
9226936571
commit
e45d80b8b0
|
@ -37,7 +37,7 @@ minutemaid() { ### @-
|
||||||
o) offset="$OPTARG";;
|
o) offset="$OPTARG";;
|
||||||
?) local fd=0
|
?) local fd=0
|
||||||
[ $name = h ] && fd=1 || fd=2
|
[ $name = h ] && fd=1 || fd=2
|
||||||
printf "%s\n" "usage: $0 [-o offset] {interval} [{command} [{args...}]]" >&$fd
|
printf '%s\n' "usage: $0 [-o offset] {interval} [{command} [{args...}]]" >&$fd
|
||||||
[ $name = h ] && return 0 || return 1;;
|
[ $name = h ] && return 0 || return 1;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
@ -46,8 +46,10 @@ minutemaid() { ### @-
|
||||||
local interval="${1:?no interval specified}"
|
local interval="${1:?no interval specified}"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
if [ "$interval" -le 0 ]; then
|
if [ "$interval" -gt 0 ] 2>/dev/null; then
|
||||||
printf "%s\n" "$0: interval must be positive" >&2
|
:
|
||||||
|
else
|
||||||
|
printf "%s\n" "$0: interval must be a positive integer" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user