diff zshrc-systemd @ 144:383ea800bf98

include sudo
author Dirk Olmes <dirk@xanthippe.ping.de>
date Mon, 17 Sep 2018 09:19:03 +0200
parents 129d5bcd9814
children
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
 }