Author: Stan Eisenstat
Subject: Re: [Cs323] Questions about Solution Script
Date: Friday, 04 Sep 2020, 22:14:20
> Message Posted By: Unknown > > When I run "/c/cs323/Hwk1/fiend /file1 /file2" and my directory doesn't > contain either file1 or file2, the output out the Hwk1/fiend script is: > > fiend: stat(/file1) Failed > fiend: stat(/file2) Failed > > From the pset, it seems like the program is supposed to exit after the > first fail, but I wanted to confirm. Since both file1 and file2 are valid filenames, this is not an error in the command-line arguments and thus does not cause fiend to exit. However, since neither file1 nor file2 exists, stat() fails on each, which results in the two error messages. ===== > Second, when I run "/c/cs323/Hwk1/fiend -exec echo {} '>' bar \;", I dont > get the expected result. I thought this sohuld print "." into bar, but it > actually prints a random file thats two subdirectories deep. Is that > expected? Yes. The command echo {} > bar is executed for EVERY file visited with {} replaced by the name of that file. Each execution overwrites the previous contents of the file bar. Thus when the preorder traversal ends, the contents of bar will be the name of the last file visited, which will not be . unless the current working directory is empty. --Stan-PREV INDEX NEXT