pentest-distro-builder/filesystem/etc/skel/.tmux/plugins/tmux-net-speed/scripts/upload_speed.sh
Kaj Forney a6d12f1ffc Move stuff to /etc/skel
Former-commit-id: 7bddceacd727c25153cd0ec03cf8b0d4011484d5
Former-commit-id: aaf57e63c1976b3960fee717c68c3b09dc1a94ff
2018-10-18 13:47:28 -06:00

29 lines
579 B
Bash
Executable file

#!/bin/bash -
CURRENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source "$CURRENT_DIR/helpers.sh"
sum_upload_speed()
{
# Output uses ninth column
sum_speed 9
}
main()
{
# TODO make configurable
#local upload_file=$(get_tmux_option $UPLOAD_FILE)
local file=$UPLOAD_FILE
local old_val=$(read_file $file)
local new_val=$(sum_upload_speed)
write_file $file $new_val
local vel=$(get_velocity $new_val $old_val)
## Format output
local format=$(get_tmux_option @upload_speed_format "%s")
printf "$format" "$vel"
}
main