quote the release strings appropriately

This commit is contained in:
Dustin Kirkland 2009-04-08 10:17:12 -07:00
commit 1c202cccd1

View file

@ -21,15 +21,18 @@ if which lsb_release >/dev/null; then
# If lsb_release is available, use it
if lsb_release -s -d | grep -qs "^Ubuntu .*\..*\..*$"; then
# Use the -d if an Ubuntu LTS
lsb_release -s -d
r=$(lsb_release -s -d)
printf "\005{=b }%s\005{-} " "$r"
else
# But for other distros the description
# is too long, so build from -i and -r
printf "\005{=b }%s %s\005{-} " $(lsb_release -s -i) $(lsb_release -s -r)
i=$(lsb_release -s -i)
r=$(lsb_release -s -r)
printf "\005{=b }%s %s\005{-} " "$i" "$r"
fi
elif [ -r "/etc/issue" ]; then
# Otherwise, grab part of /etc/issue
printf "\005{=b ..}%s\005{-} " $(head -n1 /etc/issue | awk '{print $1}')
printf "\005{=b }%s\005{-} " $(head -n1 /etc/issue | awk '{print $1}')
else
echo "Unknown"
fi