Last active
March 30, 2018 07:16
-
-
Save ming-chu/72971cff4398a52f1bf3b2c783b54760 to your computer and use it in GitHub Desktop.
Get build number using PlistBuddy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# INFOPLIST_FILE="xxx/Info.plist" | |
# echo $INFOPLIST_FILE | |
# get current plist file path=> $ what-marketing-version | grep "Found" | awk '{print $NF}' | |
# awk '{print $NF}'; will split the sentense and get the last one (NF=number of fields in the current record) | |
# | |
#PLIST_PATH=$(agvtool what-marketing-version | grep "Found" | awk '{print $NF}') | |
#PLIST_PATH="${PLIST_PATH%\"}" | |
#PLIST_PATH="${PLIST_PATH#\"}" | |
#(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$PLIST_PATH") | |
#assign to a variable | |
#BUILD_NUMBER=$(PLIST_PATH=$(agvtool what-marketing-version | grep "Found" | awk '{print $NF}') && PLIST_PATH="${PLIST_PATH%\"}" && PLIST_PATH="${PLIST_PATH#\"}" &&(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$PLIST_PATH")) | |
#one line statment: | |
(PLIST_PATH=$(agvtool what-marketing-version | grep "Found" | awk '{print $NF}') && PLIST_PATH="${PLIST_PATH%\"}" && PLIST_PATH="${PLIST_PATH#\"}" &&(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$PLIST_PATH")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment