Write a bash script that takes a file path as an argument and performs the following file tests using if, then, else, and elif syntax:

  1. Check if the file exists and is a regular file.
    • If not, print “ does not exist or is not a regular file." Exit with status 1.
  2. Check if the file is readable.
  3. Check if the file is writable.
  4. Check if the file is executable.

Example Output:

$ ./file_tests.sh testfile
testfile is a regular file
testfile is readable
testfile is writable
testfile is executable
$ echo $?
0

$ ./file_tests.sh nonexistentfile
nonexistentfile does not exist or is not a regular file
$ echo $?
1