Write a bash script file that tests each file entry in thecurrent directory. It should determine if it is a file ordirectory. If it is a file, it will determine if it is readable ornot. If it is readable, it will display only the first 4 lines tothe terminal in sorted order (just sort the first 4 lines).
If it is a directory, it should display the contents of thatdirectory (the files and subdirectories).
NOTE: Please don’t use the read command or arguments with yourscript. Note that you don’t need to use either one of these methodsto get a list of files in the current directory.
=====================================
Example Output
Note that the output
from running the script starts at
the sixth line
=====================================
$ ls -l
total 32
drwxrwxr-x 3 cocofan cocofan 4096 Jan 20 17:58 adir
--w-rw-rw- 1 cocofan cocofan 128 Mar 15 22:43 lines.dat
-rw-rw-rw- 1 cocofan cocofan 48 Sep 5 2016 months.txt
$ bash assg5.sh
ENTRY IS adir
**This is a directory**
afileinadir.txt subdirofadir
ENTRY IS lines.dat
**This is a file**
...file is not readable.
ENTRY IS months.txt
**This is a file**
...and it's readable.
...it's first four lines in sorted order are:
Apr
Feb
Jan
Mar
$
++++++++++++++++++++++++++++++++++++