Trying to check and see if a string value is NOT a member of two different arrays. If the string value does not exists in any of them, then i need to perform a statement. I was able to do it with an if statement....
if [[ $REQ_FIELDS_LIST != *"$XFR_FIELD"* && $NON_INPUT_FIELDS_LIST != *"$XFR_FIELD"* ]];then
But the asterisk is causing substrings to return false positives. Unfortunately, removing the "*" and the if statement just doesn't work at all. It seems, checking this site, that the only SAFE way to do it in bash is by doing a for loop. But what is the most efficient way of doing it for two different arrays. Also, the string value is a member of an array itself. So we are looping through an array already. Loop through array of string values and for each string value check to see if that string is not a member of the other two arrays. If so, then perform a statement.
So i need...
for XFR_FIELD in $INPUT_FIELDS_LIST
do
if XFR field is not a member of REQ_FIELDS_LIST AND is not a member of NON_INPUT_FIELDS_LIST then
"return 0"
$REQ_FIELDS_LIST && $NON_INPUT_FIELDS_LISTarrays or Variables? They are written as Variables, but you mention them as arrays. Also - how many space or other separated values are there in$INPUT_FIELDS_LIST, and is that an array?REQ_FIELDS_LISTis an array, then$REQ_FIELDS_LISTonly gets its first element; you need to use something like"$REQ_FIELDS_LIST[@]"to get all elements. But that won't work right in the test either; you really need to loop over the elements.bashand you could get a name collision with one of them.