aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
+}
+