#!/bin/sh
PID=`ps auxwwwww|grep mux|grep -e $1 -ve muxclose|awk '{print $2}'`
if [ $PID ]; then
	kill $PID
else
	echo "no such mux session found"
fi

#!/bin/bash
PID=`ps auxwwwww|grep mux|grep -ve muxclose -e grep|grep $1|awk '{print $2}'`
if [[ $PID ]]; then
	kill $PID
else
	echo "no such mux session found"
fi

Change grep to behave predictably across platforms
Change grep to behave predictably across platforms
