MacOS – Check the operating system version, then issue a command in the correct version

I am writing a bash script for Mac OS X Lion 10.7, I want to know how to check the version of the operating system in bash, if the version is 10.7.1, then it will execute the command and Continue to use the script and do the same thing for a different version. Let’s say 10.7.3 and then it executes a different command and then uses the command for 10.7.1?
OS_Version (complete…example 10.7.3)

< pre>system_profiler SPSoftwareDataType | grep “System Version” | awk'{print $6}’

either

sw_vers -productVersion

Operating system (abbreviation…Example 10.7)

system_profiler SPSoftwareDataType | grep "System Version" | awk'{print $6}' | sed "s:.[[:digit: ]]*.$::g"

or

OS_Version=$(OS (short… example 10.7) | sed "s:.[[ :digit:]]*)

Celebration:

#!/bin/bash

# Use one of the examples given above to create the OS_Version variable

if [[ ${OS_Version} == 10.7.3 ]]; then
echo "Operating System is a match... will continue on."
else
echo "Operating System is NOT a match... will NOT continue."
fi

I am working on Mac OS X Lion 10.7 write a bash script, I want to know how to check the version of the operating system in bash, if the version is 10.7.1, then it will execute the command and continue to use the script and do the same thing for a different version let’s say 10.7 .3 Then it executes a different command and then uses the command of 10.7.1?

OS_Version(Complete…Example 10 .7.3)

system_profiler SPSoftwareDataType | grep "System Version" | awk'{print $6}'

either

sw_vers -productVersion

Operating system (referred to as…Example 10.7)

system_profiler SPSoftwareDataType | grep "System Version" | awk'{print $6}' | sed "s:.[[:digit:]]*.$::g"

or

OS_Version =$(OS (short… example 10.7) | sed "s:.[[:digit:]]*)

Celebration:

#! /bin/bash

# Use one of the examples given above to create the OS_Version variable

if [[ ${OS_Version} == 10.7.3 ]]; then< br /> echo "Operating System is a match... will continue on."
else
echo "Operating System is NOT a match... will NOT continue."
fi

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 5323 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.