-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkblight.sh
46 lines (33 loc) · 869 Bytes
/
kblight.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash
# Definiendo variables
#
kbd_backlight_path=/sys/devices/platform/sony-laptop/kbd_backlight
kbd_backlight_value=$(cat $kbd_backlight_path)
argumento=${1:--auto}
# Declarando y definiendo funciones
#
auto () {
if [ $kbd_backlight_value == 1 ] ;
then echo 0 > $kbd_backlight_path ;
elif [ $kbd_backlight_value == 0 ] \
|| [ $kbd_backlight_value == 2 ] ;
then echo 1 > $kbd_backlight_path ;
fi }
on () {
if [ $kbd_backlight_value == 0 ] \
|| [ $kbd_backlight_value == 1 ] ;
then echo 2 > $kbd_backlight_path ;
fi }
off () {
if [ $kbd_backlight_value == 1 ] \
|| [ $kbd_backlight_value == 2 ] ;
then echo 0 > $kbd_backlight_path ;
fi }
# El mero mero
# main () {
if [ $argumento = -auto ] ; then auto ;
elif [ $argumento = -on ] ; then on ;
elif [ $argumento = -off ] ; then off ;
else echo "Argumento Invalido" ;
fi
# }