Opposite to expected response in awk
I am using following awk code on a file called dirlist. However, it is giving reverse response- printing out directories if they are there when asked about not there and vice versa:
Code:
$ cat dirlist |
system() returns the command's exit status. "[ -d a_dir ]" has an exit status of 0 when a_dir exists, and 1 when it doesn't exist.
Now when the if condition is nonzero, awk considers it as true. So, a nonexisting directory returns 1, which is true. |
Perfect explanation.
|
All times are GMT -5. The time now is 03:57 PM. |