changeset 144:383ea800bf98

include sudo
author Dirk Olmes <dirk@xanthippe.ping.de>
date Mon, 17 Sep 2018 09:19:03 +0200
parents 870bb3be824f
children ebcb738274d1
files zshrc-systemd
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/zshrc-systemd	Mon Sep 03 13:11:19 2018 +0200
+++ b/zshrc-systemd	Mon Sep 17 09:19:03 2018 +0200
@@ -1,3 +1,8 @@
 function sc() {
-	systemctl $2 $1
+	local SUDO=""
+
+	if [[ $USER != "root" ]]; then
+		SUDO="sudo"
+	fi
+	$SUDO systemctl $2 $1
 }