I am writing a script that checks a certain directory for any sub-directories starting with a specific word.
Here is my script thus far:
#!/bin/bash
function checkDirectory() {
themeDirectory="/usr/share/themes"
iconDirectory="/usr/share/icons"
# I don't know what to put for the regex.
regex=
if [ -d "$themeDirectory/$regex" && -d "$iconDirectory/$regex" ]; then
echo "Directories exist."
else
echo "Directories don't exist."
fi
}
So, how would you use regex
to check if a particular directory has any folders starting with a specific word?