Test Script

This commit is contained in:
Michael Grote 2022-07-17 12:57:06 +02:00
parent 94f1926a39
commit 166f0281a3

View file

@ -1,33 +1,5 @@
#!/bin/bash
if [[ -n "$1" ]]; then
case "$1" in
--lock | -l)
lock
;;
--reboot | -r)
reboot
;;
--shutdown | -s)
shutdown
;;
--suspend | -sd)
suspend
;;
--hibernate | -hb)
hibernate
;;
--help | -h)
hilfe
exit 0
;;
*)
echo -e "\e[31mUnbekannter Paremeter!"
exit 1
esac
fi
function lock {
# Take a screenshot
scrot /tmp/screen_locked.png
@ -54,13 +26,12 @@ function hibernate {
lock
sudo systemctl reboot
}
function hilfe {
function help {
echo "
Usage:
./build.sh [-l|-r|-s|-sd|-hb]
./build.sh [-r|-s|-sd|-hb]
Arguments:
-l, --lock Lock display.
-r, --reboot Reboot this system.
-s, --shutdown Shutdown this system.
-sd, --suspend Suspends this system.
@ -72,3 +43,30 @@ function display_off {
# Turn the screen off
xset dpms force off
}
if [[ -n "$1" ]]; then
case "$1" in
--reboot | -r)
reboot
;;
--shutdown | -s)
shutdown
;;
--suspend | -sd)
suspend
;;
--hibernate | -hb)
hibernate
;;
--help | -h)
exit 0
;;
*)
echo -e "\e[31mUnbekannter Paremeter!"
exit 1
esac
else
lock
fi