Results 1 to 3 of 3

Thread: /proc and shell scripts

  1. #1

    Default /proc and shell scripts

    My lenovo t61p has a little led light for lighting up the keyboard when its dark. I'd like to write a little script to turn the light on and off. The file which controls the light is located at /proc/acpi/ibm/light. The command 'echo "off|on" > light' will turn the light on or off. I'd like the script to be smart enough to figure out whether the light is on or off. The problem is that from a shell script i am unable to store the data in 'light' in a variable. If type 'cat light', i get
    status: off
    commands: on, off

    However, no matter what I try, i am unable to store this information in any way.


    Any ideas?
    Mike

  2. #2
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,683
    Blog Entries
    4

    Default Re: /proc and shell scripts

    Code:
    status=$(awk '/^status/{print $2}' /proc/acpi/ibm/light)

  3. #3

    Default Re: /proc and shell scripts

    thanks a lot. That did the trick.


    Mike

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •