Posted to tcl by kostix at Sat Oct 14 21:07:03 GMT 2006view raw

  1. proc get_lsb_info {} {
  2. if {[catch {exec lsb_release -a} info]} {
  3. return {}
  4. }
  5.  
  6. foreach line [split $info \n] {
  7. foreach {key val} [split $line :] {
  8. set fields([string tolower $key]) [string trim $val]
  9. }
  10. }
  11.  
  12. foreach key {description release codename} {
  13. if {[info exists fields($key)]} {
  14. append out "$fields($key) "
  15. }
  16. }
  17.  
  18. return [string trim $out]
  19. }
  20.