answer to nawk problem

mark hilliard mark at gizzmo.UUCP
Mon Dec 4 10:27:31 AEST 1989


OK, I found out that this was a simple case of RTFM!  Sorry, the problem 
is that the shell "if" responds for the first statement if a 0 is 
returned from the test, but the awk "if" is derived from the C "if" in 
that if a 1 is returned from the test then the first statement is 
exicuted, just the reverse! Soooo, since the test -d returns a 0 if 
true the awk if ran just the oppisite from what I expected.
Iffy enough for everyone!


$3 > 99	{ 

if ( system("test -d "$6)) {
  printf("\r\n--- %s does not exist, creating it and moving files --- \r\n",$6) 
  system("mkdir "$6) 
  }
else 
  printf("--- %s exists, moving files now ---\r\n",$6) 

}

Mark Hilliard
N2HHR
rutgers!rochester!kodak!gizzmo!mark



More information about the Comp.unix.i386 mailing list