Reputation: 2807
Hello I am having a problem with checking two variables to see whether or not they are both equal. I have the following script:
Output=$(sudo defaults read /System/Library/User\ Template/English.lproj/Library/Preferences/com.apple.SetupAssistant | grep -o "DidSeeCloudSetup = 1")
Output2=$(sudo defaults read /System/Library/User\ Template/English.lproj/Library/Preferences/com.apple.SetupAssistant | grep -o "LastSeenCloudProductVersion")
Check="DidSeeCloudSetup = 1"
Check2="LastSeenCloudProductVersion"
echo "$Output"
echo "$Check"
if [ "$Output" = "$Check" ]
then
echo "OK"
else
echo "FALSE"
Even though they both contain the same thing it always comes out false... any ideas why?
Upvotes: 0
Views: 64
Reputation: 88756
There is a special character (hex: 10) between $
and Check
in your if clause:
00000000 69 66 20 5b 20 22 24 4f 75 74 70 75 74 22 20 3d |if [ "$Output" =|
00000010 20 22 24 10 43 68 65 63 6b 22 20 5d 0a | "$.Check" ].|
Upvotes: 3