kdialog help!

I have a laptop whose screen brightness can be controlled only from nvclock.
I thought of making a small script to control the brightness, but I am
struggling to make it work with kdialog.

I need to pass a number between 15 and 100 to nvclock -Snn (where nn is the
number).

The script is just this:
#!/bin/bash
kdialog --menu “Select a brigthness value:” 20 20 40 40 60 60 80 80 100 100
nvclock -S**

where ** should be the number.
I know that $?] should return the result of the chosen kdialog choice, but
writing:
nvclock -S$?]

does not seem to pass the value.

Can somebody suggest how to do this? I have looked in quite a few places in
the net, but there is no explanation of this.

Many thanks

-G-

$? typically stores the exit code, not the return value. Try something like:


#!/bin/bash

BRIGHTNESS=`kdialog --menu "Select a brigthness value:" 20 20 40 40 60 60 80 80 100 100`
nvclock -S$BRIGHTNESS

Note the backtick (`) is not a single quote(’).

kdemello wrote:
> $? typically stores the exit code, not the return value. Try something
> like:
> Code:
> --------------------
> #!/bin/bash
> BRIGHTNESS=`kdialog --menu “Select a brigthness value:” 20 20 40 40 60

60 80 80 100 100 nvclock -S$BRIGHTNESS > -------------------- > Note the backtick () is not a single quote(’).

Excellent! Many thanks.

-G-