mirror of
https://github.com/notwa/rc
synced 2024-11-04 22:49:03 -08:00
improve interval check
This commit is contained in:
parent
9226936571
commit
e45d80b8b0
1 changed files with 5 additions and 3 deletions
|
@ -37,7 +37,7 @@ minutemaid() { ### @-
|
|||
o) offset="$OPTARG";;
|
||||
?) local fd=0
|
||||
[ $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;;
|
||||
esac
|
||||
done
|
||||
|
@ -46,8 +46,10 @@ minutemaid() { ### @-
|
|||
local interval="${1:?no interval specified}"
|
||||
shift
|
||||
|
||||
if [ "$interval" -le 0 ]; then
|
||||
printf "%s\n" "$0: interval must be positive" >&2
|
||||
if [ "$interval" -gt 0 ] 2>/dev/null; then
|
||||
:
|
||||
else
|
||||
printf "%s\n" "$0: interval must be a positive integer" >&2
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in a new issue