Ubuntu: Own brightness script, problem with missing ']'



Question:

I'm starting my adventure with Ubuntu ( I'm a MS's kid :D) and I would like to create my own scripts for controlling the brightness. I know all about the xbindkeys, and how does it works, but there is a problem with my script, which won't work properly. Terminal says, that there is an error in the line 5: [: missing ']'. Can anyone tell me whats wrong with that code? Thanks in advance!

#!/bin/bash  brightness=$(cat "/sys/class/backlight/intel_backlight/actual_brightness")  a=$((brightness+2))  if [ "$brightness" -lt 3]  then      echo $a >> /sys/class/backlight/intel_backlight/actual_brightness  fi  


Solution:1

In

if [ "$brightness" -lt 3]  

there needs to be a space before the ]:

if [ "$brightness" -lt 3 ]  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »