Vote count:
0
My Motivation is simple: I am going to execute a shell script from the normal user who has the sudo access. Upon the execution of the shell script, it will interact with the user with Zenity for taking some value and will edit the system file (/sys/class/backlight/radeon_bl0/brightness) with that value.
Script is as below:
#!/bin/bash
#spawn su -
#expect "Password: "
#send "password\r"
#interact
gksu -u root -Sw
temp=$(mktemp /tmp/tmp.XXXXXXX)
trap "rm $temp" 0 1 2
Current_Brightness=`cat /sys/class/backlight/radeon_bl0/brightness`
New_Brightness=`zenity --entry --entry-text="$Current_Brightness" --text="Set Brightness value between 20 (min) to 255(max)" --title="Choose Brightness value carefully!"`
echo "Value of New Brightness: $New_Brightness"
sudo echo "$New_Brightness" > /sys/class/backlight/radeon_bl0/brightness
I don't want to change the permission of the file
asked 59 secs ago
Aucun commentaire:
Enregistrer un commentaire