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

proc get_lsb_info {} {
    if {[catch {exec lsb_release -a} info]} {
        return {}
    }

    foreach line [split $info \n] {
        foreach {key val} [split $line :] {
            set fields([string tolower $key]) [string trim $val]
        }
    }

    foreach key {description release codename} {
        if {[info exists fields($key)]} {
            append out "$fields($key) "
        }
    }

    return [string trim $out]
}