So this is my shell script so far, it's very simple
I just want the user to give a directory, then it'll find it and give back the permissions and name of the files in the directory.
echo '#!/bin/bash' > ex1
echo 'echo 'Which is the directory to list?'' >> ex1
echo 'read directory' >> ex1
echo 'path=`find / -type d -name $directory`' >> ex1
echo '$(find $path -printf '%M %P\n')' >> ex1
./ex1: line 5: drwxr-xr-x: command not recognized
echo '$(find $path -printf '%M %P\n')' >> ex1
Get rid of the $(...)
. Just run the find command directly. You also should fix the inner single quotes, such as by switching them to double quotes.
echo 'find $path -printf "%M %P\n"' >> ex1