Re: Using the find command
Alan Chandler <alan@chandlerfamily.org.uk> writes:
>At one point it does
> clean /run "! -xtype d ! -name utmp ! -name innd.pid" || ES=1
> clean /run/lock "! -type d" || ES=1
> clean /run/shm "! -type d" || ES=1
>which looks as though (with the "! - xtype d...") that its trying not to
>recurse down the subdirectories of /run (otherwise why follow the clean
>/run with clean /run/lock)
No, that does not stop find recursing into directories. It will just stop
it performing its action on directories. That is, it will not delete
directories.
To stop recursion into directories, there would have to be a -prune
in there somewhere.
>what in effect is happening is its cd to /run
>then calls find
>find . "! -xtype d ! -name utmp ! -name innd.pid" -delete
This is not correct. It will run find without those quotes since the
invocation of the find(1) command in the clean() function does not use
quotes around the variable expansion.
>I tried running
>find . "! -xtype d ! -name utmp ! -name innd.pid"
That is trying to treat the whole part within the quotes as a single
filename, which is why you get the error:
>b) it finishes up with a line which says find: `! -xtype d ! -name utmp
>! -name innd.pid': No such file or directory
It is the same as running:
find dir1 dir2
which will then just print out all the files/directories under these two
directories.
Reply to: