[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Not matching string with wildcard in if statement
From: |
Jeffrey Walton |
Subject: |
Not matching string with wildcard in if statement |
Date: |
Mon, 9 Mar 2020 12:19:27 -0400 |
Hi Everyone,
I'm having a problem that I need help with. I think I can't see the
forest through the trees...
I have two env vars:
export IOS_CPU=armv7s
export IOS_SDK=iPhoneOS
I then miss the match in a script:
#!/usr/bin/env bash
if [[ "$IOS_SDK" == "iPhoneOS" && "$IOS_CPU" == "armv7*" ]]; then
MIN_VER=-miphoneos-version-min=7
elif [[ "$IOS_SDK" == "iPhoneOS" && "$IOS_CPU" == "arm64" ]]; then
MIN_VER=-miphoneos-version-min=7
...
else
echo "IOS_SDK and IOS_CPU are not valid. Please fix them"
exit 1
fi
I've got 'set -x' on and I see the compare is being made and missed
(https://travis-ci.org/noloader/cryptopp/jobs/660221143):
# Echo variables
IOS_SDK: iPhoneOS
IOS_CPU: armv7s
# set -x
+++[[ iPhoneOS == \i\P\h\o\n\e\O\S ]]
+++[[ armv7s == \a\r\m\v\7\* ]]
+++[[ iPhoneOS == \i\P\h\o\n\e\O\S ]]
+++[[ armv7s == \a\r\m\6\4 ]]
...
Why am I failing to match the string "armv7s" with "armv7*" ?
Thanks in advance.
- Not matching string with wildcard in if statement,
Jeffrey Walton <=