diff options
| author | Mitch Riedstra <mitch@riedstra.us> | 2018-11-07 23:47:38 -0500 |
|---|---|---|
| committer | Mitch Riedstra <mitch@riedstra.us> | 2018-11-07 23:47:38 -0500 |
| commit | b359a2406c888db5286a5fd5937f3cb4740b634a (patch) | |
| tree | 925ba19f81f0388f0958cccc5ccf4647c802163c /tmux_helper.sh | |
| parent | a18a1072780edb87bd1e934010af2f7126f301bb (diff) | |
| download | dotfiles-b359a2406c888db5286a5fd5937f3cb4740b634a.tar.gz dotfiles-b359a2406c888db5286a5fd5937f3cb4740b634a.tar.xz | |
update helper functions in tmux
Diffstat (limited to 'tmux_helper.sh')
| -rw-r--r-- | tmux_helper.sh | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/tmux_helper.sh b/tmux_helper.sh index 7ba09ee..7ce68bd 100644 --- a/tmux_helper.sh +++ b/tmux_helper.sh @@ -2,26 +2,27 @@ # Little helper script to clean up the nasty embeded commands in my tmux configuration -# Be careful if you add commands that you don't cause infinite recursion by calling -# a command the same name as an executable on the system you're using. e.g. uptime() { uptime | sed ... } +# Functions ripped out of `mkshrc`, worth checking out -memory() { +_sys_memory() { if [ `uname` = "Linux" ] ; then vmstat | tail -n1 | awk '{print $4/1024}' | sed -e's/\..*$//g' elif [ `uname` = "FreeBSD" ] ; then vmstat | tail -n1 | awk '{print $5/1024}' | sed -e's/\..*$//g' + elif [ `uname` = "OpenBSD" ] ; then + vmstat | sed -n '$p' | awk '{print $4}' | sed 's/M$//' fi } -load() { +_sys_load() { # Works on BSD too, neat. uptime | sed -re's/^.*load averages?: ([0-9]+\.[0-9]+).*$/\1/g' } -s_uptime() { +_sys_uptime() { # Took awhile to figure out, but this works on BSD as well - uptime | sed -re's/^.*up[ ]+//g' -e's/^([^,]*),.*/u:\1/g' -e's/^([^ ]+)[ ]*(.).*/\1\2/g' + uptime | sed -re's/^.*up[ ]+//g' -e's/^([^,]*),.*/\1/g' -e's/^([^ ]+)[ ]*(.).*/\1\2/g' } -$1 +_sys_$1 |
