summaryrefslogtreecommitdiff
path: root/example.sh
blob: 875f1f74720fafc7a1c6fd42482a8f15a3616d31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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