This may be a basic bash array/string operation related question, but I couldn't find any direct answer. So here it goes:
I have a lot of data sorted in various directories. All directories need same processing except for a special group of directories. I have a symbolic link of the script in discussion in each directory. I want the script to get the name of the current directory, check if that belongs to special group and do specific operations.
So I get the name of the directory
Code:
mm=`basename \`pwd\``
Now the the group of directories that needs something different to be done, contains these directories:
Code:
user member default MIT qly ...
I was thinking if something like this is possible:
Code:
GRPS=(user member default MIT qly ...)
if [[ $mm is a member of $GRPS array ]]; then
echo "Special"
fi
So essentially I am looking for an operator/function that searches for a substring/member in a string/array and returns some indication of success or failure.
TIA,