I'm trying to write a script that will descend into each subdirectory in /home and find the public_html folder within.
Then it will check if an .htaccess already exists, if it does write that to a file, if it doesn't exist place the .htaccess file in public_html
Right now I have
#!/bin/bash
FILE=.htaccess
for d in */; do
cd "${D}"
cd public_hmtl
if [-e $FILE ]; then
echo "Htaccess exists for "${D}" >> /test/error.txt
else
cp /htaccess ./
fi
This is obviously not right as it doesn't even run. I haven't had much experience with bash and it's been awhile since I've needed to use it.