Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8703785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T02:56:39+00:00 2026-06-13T02:56:39+00:00

When compiling a project, this script should increment the Build Version of the Xcode

  • 0

When compiling a project, this script should increment the Build Version of the Xcode project by one, when the system username matches. Keep in mind that these are just Unix commands in a script (not Applescript, Python, or Perl) inside Target->Build Phases->Run Script in Xcode.

I’ve done “echo $USER” in terminal. This prints the username of the logged-in user just fine, and it’s the same string I placed in the conditional statement in the second block of code.

The first block of code works. The second, which adds the conditional statement, does not.

#!/bin/bash
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"

#!/bin/bash
username=$USER
if [ username == "erik" ]; then
buildNumber=$(/usr/libexec/PlistBuddy -c "Print CFBundleVersion" "$INFOPLIST_FILE")
buildNumber=$(($buildNumber + 1))
/usr/libexec/PlistBuddy -c "Set :CFBundleVersion $buildNumber" "$INFOPLIST_FILE"
fi

Syntax concerns:

Parsing of $USER (case sensitive)

Semicolon right after closing bracket in if statement

Then statement on same line as if statement

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T02:56:40+00:00Added an answer on June 13, 2026 at 2:56 am

    You can see the script log in the Log Navigator, with your script i’ve got the following issue:

    enter image description here

    I believe the default comparison is case sensitive, to make it not sensitive you can change the username to uppercase/lowercase before comparison:

    if [ `echo $USER | tr [:lower:] [:upper:]` = "USERNAME" ]; then
    echo "Got user check"
    fi
    

    As you can see I moved $USER to the condition to avoid additional var usage and the script failure.

    And the semicolon at if-then block is a normal thing, check the man page. then word might be moved to the new line if that is more convenient for you to read.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a pure Action Script 3 project which I am compiling with the
I get this error when compiling an AS3/Flex project: Error 1118: Implicit coercion of
The background to this problem is that I'm doing a computing project which involves
I'm undertaking a project with a learning purpose. Since this project is compelling to
When compiling my project with gcc and the -Wall option, I get a warning
When compiling my project, I get the error: Error: D:\Programming\Projects\Aprovado\examwindow.cpp:6: error: invalid use of
Yesterday I installed clang 3.1 and g++ 4.7 and tried compiling a project I'm
I'm compiling a NAnt project on linux with TeamCity Continuous Integration server. I have
I have a .NET project that I've been compiling with Visual Studio and running
I have a ATL COM project that was compiling fine in VC6 which gives

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.