lewismc commented on code in PR #980:
URL: https://github.com/apache/nutch/pull/980#discussion_r4351188588
##########
src/bin/crawl:
##########
@@ -54,25 +54,28 @@
## @audience private
## @stability stable
function __to_seconds() {
- NUMBER=$(echo $1 | tr -dc '0-9')
- MODIFIER=$(echo $1 | tr -dc '[^s|h|m|d]]')
+ NUMBER=$(printf '%s' "$1" | tr -dc '0-9')
+ # Same characters the previous tr expression kept: lowercase suffixes plus
+ # the literal brackets, caret, and pipe.
+ MODIFIER=$(printf '%s' "$1" | tr -dc '[]^dhms|')
case $MODIFIER in
m|M)
- SECONDS=`expr $NUMBER \* 60`
+ SECONDS=$((10#$NUMBER * 60))
;;
h|H)
- SECONDS=`expr $NUMBER \* 120`
+ # h means 120 seconds here, not 3600. A follow-up issue tracks the
correction.
Review Comment:
Tracked via https://issues.apache.org/jira/browse/NUTCH-3224
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]