93,9 → 93,6 |
# /gp' | sed -e '/^[[:space:]]*$/d' -e 's/.*\(SEARCH\).*/\1/' |
# possibly + -e '/^$/d' and -e '/SEARCH/!d' |
# - 'egrep' is deprecated in SUS v2, 'grep -E' replaces it [[x2]] |
# * UNIX filter equivalencies |
# - cut -d: -f1 === awk -F: '{print $1}' === awk '{BEGIN FS=":"}; {print $1}' |
# - grep -v pattern === sed '/pattern/d' |
# }}} # TO-DO |
|
# {{{ # Constants |
1320,20 → 1317,22 |
# 2: quote secs.ms |
# 3: quote SECSs.ms |
# 4: quote secs at end of string |
# ... from hereon add the products and additions |
# ... |
NEWCODETEST=$(echo $s | sed -r \ |
-e 's/([0-9]*)([hms])/"\1"\2/g' \ |
-e 's/([0-9]*\.[0-9]*)/"\1"/g' \ |
-e 's/(([0-9][0-9]*)s?\.([0-9][0-9])*)$/"\2"s"\3"/' \ |
-e 's/([0-9][0-9]*)$/"\1"s/' ) |
# ... now add the products and additions |
# 5: h * 3600 |
# 6: m * 60 |
# 7: s (* 1) |
# 8: strip trailing, empty, addition |
NEWCODETEST=$(echo $s | sed \ |
-e 's/\([0-9]*\)\([hms]\)/"\1"\2/g' \ |
-e 's/\([0-9]*\.[0-9]*\)/"\1"/g' \ |
-e 's/\(\([0-9][0-9]*\)s?\.\([0-9][0-9]\)*\)$/"\2"s"\3"/' \ |
-e 's/\([0-9][0-9]*\)$/"\1"s/' \ |
NEWCODETEST=$(echo "$NEWCODETEST" | sed -r \ |
-e 's/h/ * 3600 + /g' \ |
-e 's/m/ * 60 + /g' \ |
-e 's/s/ + /g' \ |
-e 's/ + $//' \ |
-e 's/ \+ $//g' \ |
) |
for item in $(echo "$s" | grep -o '[0-9]*[hms]') ;do |
n="\"$(echo $item | grep -o '[0-9]*')\"" # Number, quoted |
4449,7 → 4448,7 |
eval set -- "$TEMP" |
|
while true ; do |
case $1 in |
case "$1" in |
-i|--interval) |
check_constraint 'interval' "$2" "$1" || die |
INTERVAL=$(get_interval $2) |
4468,9 → 4467,9 |
;; |
-o|--output) |
current=${#OUTPUT_FILES[@]} |
OUTPUT_FILES[$current]=$2 |
OUTPUT_FILES[$current]="$2" |
shift ;; |
-u|--username) USERNAME=$2 ; USR_USERNAME=$USERNAME ; shift ;; |
-u|--username) USERNAME="$2" ; USR_USERNAME="$USERNAME" ; shift ;; |
-U|--fullname) |
# -U accepts an optional argument, 0, to make an anonymous signature |
# --fullname accepts no argument |
4488,9 → 4487,9 |
else # No argument, default handling (try to guess real name) |
idname=$(id -un) |
if type -p getent >/dev/null ; then |
USERNAME=$(getent passwd "$idname" | cut -d':' -f5 | sed 's/,.*//g') |
USERNAME=$(getent passwd "$idname" | cut -d':' -f5 |sed 's/,.*//g') |
else |
USERNAME=$(grep "^$idname:" /etc/passwd | cut -d':' -f5 | sed 's/,.*//g') |
USERNAME=$(grep "^$idname:" /etc/passwd | cut -d':' -f5 |sed 's/,.*//g') |
fi |
if [[ -z $user ]]; then |
USERNAME=$idname |