summaryrefslogtreecommitdiff
path: root/example.sh
diff options
context:
space:
mode:
Diffstat (limited to 'example.sh')
-rwxr-xr-xexample.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/example.sh b/example.sh
new file mode 100755
index 0000000..875f1f7
--- /dev/null
+++ b/example.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# POSIX shell doesn't have >() so we need a subshell
+exec 3>&1
+{
+ exec 9>&1 1>&3
+ # do work
+ echo Working...
+ sleep 10
+ # still works if we die!
+ kill -9 $$
+} | ./inhibit-screensaver posix-sh-inhibitor-example testing
+
+# otherwise, here the inhibition would be lifted
+echo test