I was given a (I suppose) a simple task which I don't know how to do. Before coming here I have read a dozen of awk tutorials (full read, not just line-skipping) but I still don't know how to do this.
Task:
Write an script file 'check.awk' with a parameter current directory that finds all read-only files and displays these. Check also that these exist and are not directories.
First off, I don't really understand the instruction. How to pass a parameter current directory? "./"?
I started with a simplified task - to print out a string for each file in a given directory like this:
BEGIN{
}
{
print "found a file"
}
END{
}
But, it doesn't work:
awk -f 9.awk testdir
awk: 9.awk:3: fatal: cannot open file `testdir' for reading (Success)
Please help me out, I've been hammering my head for hours now :wall:
My point exactly! I know this is a piece of cake with "ls" and I don't really understand why to do it with awk. It's like driving a screw with a hammer - totally wrong tool.
But this doesn't change my situation, sadly.
Can someone tell me what is wrong with
awk: 9.awk:3: fatal: cannot open file `testdir' for reading (Success)
?