]> gitweb.fluxo.info Git - scripts.git/commitdiff
Adds suser
authorSilvio Rhatto <rhatto@riseup.net>
Mon, 9 Oct 2017 12:29:07 +0000 (09:29 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Mon, 9 Oct 2017 12:29:07 +0000 (09:29 -0300)
suser [new file with mode: 0755]

diff --git a/suser b/suser
new file mode 100755 (executable)
index 0000000..6d2eaaf
--- /dev/null
+++ b/suser
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+#
+# A shorthand for changing to a user
+#
+
+# Parameters
+BASENAME="`basename $0`"
+USER="$1"
+
+if [ -z "$USER" ]; then
+  echo "usage: $BASENAME <user>"
+  exit 1
+fi
+
+sudo su $USER -s $SHELL