pentest-distro-builder/filesystem/root/.tmux/plugins/tmux-net-speed/scripts/upload_speed.sh
Kaj Forney 582f5b5f5c Add autologin and custom tmux config.
Former-commit-id: 09eacc3f3f761c2b3454d20356ba085d18bdb722
Former-commit-id: 89d8a1302bd2a72239fbe9ad9820be4ecda76cab
2018-09-27 17:40:01 -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