[beginner bash]
#!/bin/bash
# top of the file needs to be #!/bin/bash
# set current working directory to the directory of the script
cd "$(dirname "$0")"
find . -mindepth 2 > directories.txt
# make your script executable in terminal
chmod a+x (yourscriptname)