Give permissions to run bash script

chmod a+x script.sh

Use this if you get a Permission denied error.

Write and append to files

Write to a file using the > command.

script > run.log

The print statements of the script will be outputted to run.log.

Append to a file using the >> command.

script >> run.log

This is useful if you have loops and want to store the outputs of each loop.

Remove files

rm -rf script