On Tue, Jan 26, 2010 at 1:15 PM, Les Mikesell lesmikesell@gmail.com wrote:
On 1/26/2010 11:42 AM, James B. Byrne wrote:
On Mon, January 25, 2010 13:40, Les Mikesell wrote: .
I'd say it is more likely that the command that resulted in an error wasn't exactly what was posted or there is a filesystem problem.
I do not consider a file system issue, as in error or corruption, highly probable in this case. It might be, however, that something returned by the find caused rm itself to choke.
Causing one instance of the per-file rm invocations to choke shouldn't bother the rest. And while file system corruption isn't likely, it is still a possible cause of generally-strange behavior. The most probable thing still seems like there was an unquoted * on the line that was actually typed when the error was reported.
To illustrate what you and others were saying I did the following:
[kwan@linbox find_test]$ cat add_one.sh #!/bin/sh
COUNTER=`cat counter` COUNTER=`expr ${COUNTER} + 1` echo ${COUNTER} echo "${COUNTER}" > counter
[kwan@linbox find_test] mkdir foo; cd foo; for i in $(seq 1 1 20); do touch a${i}; done
[kwan@linbox find_test]$ ls add_one.sh counter foo
[kwan@linbox find_test]$ ls foo a1 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 a2 a20 a3 a4 a5 a6 a7 a8 a9
[kwan@linbox find_test]$ echo "0">counter [kwan@linbox find_test]$ find foo -name "a*" |xargs ./add_one.sh 1 [kwan@linbox find_test]$ echo "0">counter [kwan@linbox find_test]$ find foo -name "a*" -exec ./add_one.sh {} ; 1 2 [snip] 18 19 20
Finally: [kwan@linbox find_test]$ find foo -name a* -exec ./add_one.sh {} ; [kwan@linbox find_test]$
(This last one has no results because the a* is not quoted and therefore expanded by the shell before it hits the find command. )