From cf89b3457feaa7f7695fc992d25473f773423008 Mon Sep 17 00:00:00 2001 From: "Alex Xu (Hello71)" Date: Wed, 16 Aug 2017 20:36:09 -0400 Subject: Initial commit --- example.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 example.sh (limited to 'example.sh') 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 -- cgit v1.2.3-54-g00ecf