Make Bash script exit and print error message if users invoke the .... scriptname file > newfile , the shell interprets file as the only argument to .
stackoverflow.com