Variable assignment
Syntax assignment of variables :
name=value
Note that there are no spaces around the = sign. If the value has spaces or special characters, it must be specified with single quotes:
name='value with spaces or special characters'
or with double quotes for variable expansion :
name="stringA $variable stringB"
If quotation marks are missing, the second word in the meaning part is interpreted as a command. In fact, this is a way to pass environment variables to a command (see below).
If there is no value, a variable with an empty value is created.
Environment Variables
There is another syntax that allows you to assign environment variables to a command:
nameA=valueA nameB=valueB nameC=valueC command arguments
name-value pairs are separated by spaces.
Example
LD_PRELOAD=/path/to/my/malloc.so /bin/ls
The command assigns the environment variable /path/to/my/malloc.so to the LD_PRELOAD variable before calling /bin/ls .
Your teams
So your command:
projectName= echo $tempPBXProjFilePath
actually means that you invoke the echo command with the expand arguments from $tempPBXProjFilePath and set the projectName environment projectName to an empty value.
And this command:
projectName=echo $tempPBXProjFilePath
sets the projectName environment projectName to the echo string and invokes the command extended from the $tempPBXProjFilePath variable.
Note that if a variable is not enclosed in double quotation marks, special characters displayed in its value are interpreted by the shell. To prevent reinterpretation of special characters, you should use weak quotation: "$variable" . And if you want to prevent even the expansion of a variable in a string value, use single quotes: 'some value' .