I'm trying to come up with the syntax for a regex in an IF statement, but I'm not quickly having success... Can anyone lend a quick hand please?
if [[ "$path/$file" =~ .{txt,doc,docx,xlsx,rtf} ]];
then
echo "hello"
fi
I'm trying to come up with the syntax for a regex in an IF statement, but I'm not quickly having success... Can anyone lend a quick hand please?
if [[ "$path/$file" =~ .{txt,doc,docx,xlsx,rtf} ]];
then
echo "hello"
fi
That's pretty close to a glob pattern. Try
If you really want a regular expression
Finding a regular expression tutorial online left as an exercise ...