#!/bin/bash # $HeadURL: https://svn.pasta.freemyip.com/main/miniade/trunk/bin/nop-sh $ $LastChangedRevision: 10133 $ # Modules . $(miniade) || { echo "${0##*/}: ERROR: miniade failed (hint: run 'miniade' to see error)" >&2; exit 1; } # Configurable stuff # Other globals main() { local MY_ARGS # Defaults for options # Process options miniade_process_options MY_ARGS "$@" && set -- "${MY_ARGS[@]}" # Process arguments [ $# = 0 ] || miniade_bad_usage # Sanity checks and derivations # Guts echo -n "final value: " read FINAL_VALUE echo -n "current value: " read FIRST_VALUE { ! [[ $FIRST_VALUE =~ ^0x ]]; } || FIRST_VALUE=$(printf "%d" $FIRST_VALUE) FIRST_TIME=`date '+%s'` while :; do echo -n "current value: " read SECOND_VALUE { ! [[ $SECOND_VALUE =~ ^0x ]]; } || SECOND_VALUE=$(printf "%d" $SECOND_VALUE) SECOND_TIME=`date '+%s'` perl -e "printf \"estimated time of arrival: %s\n\", scalar localtime ($FIRST_TIME + ($FINAL_VALUE-$FIRST_VALUE)*($SECOND_TIME-$FIRST_TIME)/($SECOND_VALUE-$FIRST_VALUE));" done } main "$@"