aboutsummaryrefslogtreecommitdiff
path: root/tmux_helper.sh
blob: 7ba09eea0cc878578aac435eaef225233e7f639d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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