I am new to bash. I have a question about determining if all characters of one string occur within another string. For example, if the variables are:
var_1="abcdefg"
var_2="bcg"
Then I want to write an if statement of the form:
if [all characters of var_2 occur within var_1]
then
echo "All characters of var_2 occur in var_1."
else
echo "Not all characters of var_2 occur in var_1."
fi
In this example, the output should be All characters of var_2 occur in var_1. What would go in the if statement here?
This is what I tried:
if [[ $var_1 == *$var_2* ]]
... but I think this is only determines if var_2 is a substring of var_1. What I want is to determine if the characters of var_2 occur within var_1 in no particular order.