From 5ea6e75a796633d32f2ddce373242c972c7b2e1d Mon Sep 17 00:00:00 2001 From: Mitch Riedstra Date: Fri, 19 Jan 2018 01:27:21 -0500 Subject: Clena up tmux configuration and add a helper script. Tell mkshrc to pull the helper --- tmux_helper.sh | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tmux_helper.sh (limited to 'tmux_helper.sh') diff --git a/tmux_helper.sh b/tmux_helper.sh new file mode 100644 index 0000000..7ba09ee --- /dev/null +++ b/tmux_helper.sh @@ -0,0 +1,27 @@ +#!/bin/sh + + +# 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 ... } + +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' + fi +} + +load() { + # Works on BSD too, neat. + uptime | sed -re's/^.*load averages?: ([0-9]+\.[0-9]+).*$/\1/g' +} + +s_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' +} + + +$1 -- cgit v1.2.3