Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
- The problem statement, all variables and given/known data:
Create a Shell script that looks for all text files in your home directory (including subdirectories).
List only text files that all members of your group are able to "read and write".
These files shall be listed in the order "date of last change on file".
The permissions on and the full path of each file shall be listed, too.
-
Relevant commands, code, scripts, algorithms:
-
The attempts at a solution (include all code and scripts):
This is my solution (until now):
Here I'm looking for the file's extension "*.txt" but actually I've to look for the mime-type or so. Therefor the "file command" exists but I've no idea to adopt the mime-type into my script instead of the extension's search?
#! /bin/bash
find ~ -name "*.txt" -printf "%M %f %TY%Tm%Td%TH%TM%TS %TY %Tm %Td %TH %TM %p\n" | sort -nk3 |
awk '/^....rw/{
filecnt = filecnt + 1
printf ("No. %s", filecnt);
printf (" *** filename: %s", $2 )
printf (" *** filerights: %s", $1);
printf (" *** last change on: %s.%s.%s um %s:%s h\n",$6, $5, $4, $7, $8)
printf (" *** file path: %s\n", $9);
printf ("\n");
}'
- Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
HAW Hamburg, Hamburg (Hamburg), Germany, Schneider, BS,http://ds2.etech.haw-hamburg.de/snd/veranst.html