From 59fa47cb95a6fd68832b7cc843fe1b843d8309e6 Mon Sep 17 00:00:00 2001 From: Austen Adler Date: Wed, 30 Mar 2016 13:29:12 -0400 Subject: [PATCH] Implememnt st command --- shells/zshrc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/shells/zshrc b/shells/zshrc index 0c773a9..a0eb8cc 100644 --- a/shells/zshrc +++ b/shells/zshrc @@ -26,6 +26,25 @@ export EDITOR='vim' $ () { $* } +st () { + command="${@: -1}" + while (( $# > 1 )); do + if [[ "$command" == "r" ]]; then + echo "Restarting $1" + sudo service "$1" restart + elif [[ "$command" == "s" ]]; then + echo "Starting $1" + sudo service "$1" start + elif [[ "$command" == "x" ]]; then + echo "Stopping $1" + sudo service "$1" stop + elif [[ "$command" == "i" ]]; then + echo "Status of $1" + service "$1" status + fi + shift + done +} asroot(){ # Use temporary file for added security TEMPFILE=$(tempfile)