Advertising
Paste Description for osversion
My script to determine OS version for Fedora, Ubuntu and Mac OS X.
- osversion
- Thursday, August 30th, 2007 at 12:02:21pm MDT
- #!/bin/csh -f
- if(-r /etc/fedora-release) then
- cat /etc/fedora-release
- else if(-r /etc/lsb-release) then
- perl -ne 'if(/DESCRIPTION/) { s/.*="(.*)"/$1/; print; }' /etc/lsb-release
- else if(-d /System/Library) then
- set version_plist=System/Library/CoreServices/SystemVersion.plist
- foreach vol (/Volumes/*)
- if(-r "$vol/$version_plist") then
- set name=`defaults read "$vol/${version_plist:r}" ProductName`
- set build=`defaults read "$vol/${version_plist:r}" ProductBuildVersion`
- set version=`defaults read "$vol/${version_plist:r}" ProductUserVisibleVersion`
- printf "%-16s %10s %-10s %10s\n" "${vol:t}" "$name" "$version" "(build $build)"
- endif
- end
- else
- echo "Unknown OS: `uname -s`"
- endif
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will expire by default in one month. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.