I need a script that takes a single command line argument that is a directory path. The script should check the argument to determine if it is in fact a directory. If it is a directory, then the script should change the protection mode of any subdirectories located in it to 600. If the argument is not a directory, then an appropriate message should be printed out.
I have
if [ -d $1 ] ; then
else
echo “This is not a directory”
fi
Basically I don’t know what to put on the blank line. I was fooling around with chmod but my line seemed to want to change the inputted path and not just the subdirectories.
if test -d "$1"; then find "$1" -type d -exec chmod 600 '{}' \; else echo "Not a directory: $1" >&2 exit 1 fiVarious variants may be faster, but depend on features not in ancient
findorxargs.