}
distro-num() {
- # Subshell keeps environment clean.
- ( . /etc/os-release
- # in ubuntu the .x matters, trisquel it doesnt
- if [[ $ID == ubuntu ]]; then
- echo $VERSION_ID
- else
- echo ${VERSION_ID%%.*}
- fi
- )
+ local os_id ver_id
+ os_id=$(awk -F = '$1 == "ID" { print $2 }' /etc/os-release)
+ ver_id=$(awk -F = '$1 == "VERSION_ID" { print $2 }' /etc/os-release | sed 's/"//g')
+ # of VERSION_ID.x, the x matters in ubuntu but not trisquel
+ if [[ $os_id == ubuntu ]]; then
+ printf "%s\n" "$ver_id"
+ else
+ printf "%s\n" "$ver_id" | sed 's/\..*//'
+ fi
}
debian-archive() {