|
#1
| |||
| |||
| cli the OS version? I'm working on a shell script and need to be able to pull the OS version and the version of Safari in order to do various things... I can get Safari's version number from the /Applications/Safari.app/Contents/version.plist file and with some creative sed should be able to finagle just the version number. For the OS version, using will get me close enough to manipulate: system_profiler SPSoftwareDataType |grep "System Version" But I was curious if there was a more obvious and simpler way to do this from the command line. Thanks! |
|
#2
| |||
| |||
| Solved So there are a plethora of ways all better than what I was doing: Code: system_profiler -xml SPSoftwareDataType | awk '/os_version/{getline;print $4}' It seems the less complicated way is: Code: sw_vers -productVersion Code: defaults read /System/Library/CoreServices/SystemVersion ProductVersion Code: cat /Applications/Safari.app/Contents/version.plist | awk '/CFBundleShortVersionString/{getline;print $1}' | sed -e :a -e 's/<[^>]*>//g;/</N;//ba' Code: defaults read /Applications/Safari.app/Contents/version CFBundleShortVersionString |
|
#3
| |||
| |||
| $ sysctl -n kern.osversion But, the version it gives is a hexnumber: 9C7010 (same as your version has in parentheses), so I am not sure if it helps. |