aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2013-09-30 08:54:23 +0200
committerMattias Andrée <maandree@operamail.com>2013-09-30 08:54:23 +0200
commit9621b0c61845394b4d67c21a017eb8e046d09743 (patch)
tree7e8f372d1498e74570d125bf8e30a788faca0d88
parentpreserve ssh flags' casing when converting username to lower case (diff)
downloadgates-of-tartaros-9621b0c61845394b4d67c21a017eb8e046d09743.tar.gz
gates-of-tartaros-9621b0c61845394b4d67c21a017eb8e046d09743.tar.bz2
gates-of-tartaros-9621b0c61845394b4d67c21a017eb8e046d09743.tar.xz
add commands gotrc example
Signed-off-by: Mattias Andrée <maandree@operamail.com>
-rw-r--r--Makefile2
-rw-r--r--gotrc-examples/commands36
2 files changed, 37 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 257c174..9a36e1a 100644
--- a/Makefile
+++ b/Makefile
@@ -12,7 +12,7 @@ SSH = ssh
BASH_SHEBANG = /usr/bin/env bash
-EXAMPLES = lower-left-ponysay allow-uppercase issue-file
+EXAMPLES = lower-left-ponysay allow-uppercase issue-file commands
diff --git a/gotrc-examples/commands b/gotrc-examples/commands
new file mode 100644
index 0000000..f4c6677
--- /dev/null
+++ b/gotrc-examples/commands
@@ -0,0 +1,36 @@
+# -*- shell-script -*-
+
+# The module allows you to launch a few programs without even logging in
+
+
+login_function_commands=$login_function
+login_function=_login_commands
+
+function _login_commands
+{
+ if [ "${user::1}" = "+" ]; then
+ if [ "${user}" = "+shutdown" ]; then
+ shutdown
+ elif [ "${user}" = "+reboot" ]; then
+ reboot
+ elif [ "${user}" = "+backlight" ]; then
+ if [ "${LANG/UTF-8/}" = "${LANG}" ]; then
+ export LANG="en_GB.UTF-8"
+ fi
+ adjbacklight
+ else
+ echo <<EOF
+Command is not recognised.
+Recognised commands include:
+
++shutdown Shutdown the computer
++reboot Reboot the computer
++backlight Adjust the backlight
+EOF
+ read
+ fi
+ else
+ $login_function_commands
+ fi
+}
+