The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 01-04-2009
kermit's Avatar
kermit kermit is offline
Registered User
  
 

Join Date: Jan 2007
Posts: 24
Quote:
Originally Posted by cfajohnson View Post

You can use shell parameter expansion to extract what you want. E.g.:


Code:
temp=$( sensors | grep 'CPU Temp:' )
temp=${temp##*/}

Thank you. I ended up doing the following (It is not the complete script, but the part I asked about works well.)


Code:
cur_tmp=$(sensors | grep 'CPU Temp:' | awk '{ print $3 }')
cur_tmp=${cur_tmp#+}
cur_tmp=${cur_tmp%°C}