Tag Info

New answers tagged

0

The find(1) manual says it all : -perm -mode All of the permission bits mode are set for the file. Symbolic modes are accepted in this form, and this is usually the way in which would want to use them. You must specify `u', `g' or `o' if you use a symbolic mode. See the EXAMPLES section for some ...


0

I'd strongly recommend avoiding eval -- it tends to work great in simple tests, but then in production some unexpected shell metacharacter(s) show up and cause havoc. And if you have user input going into the string, it's virtually guaranteed that you'll wind up with security problems. Consider what'd happen if someone could add x'$(rm /somethingimportant)'y ...


0

I think the answer to is there anything slightly less complicated? is no. I tried your example and it did the job... $ find . -type f \( -exec fuser -s {} \; -o -print \) ./a_temp_file ./another_temp_file $ ( sleep 10 ) > file_open_for_10_secs & [2] 31969 $ find . -type f \( -exec fuser -s {} \; -o -print \) ./a_temp_file ./another_temp_file $ ...


1

your problem is the simple quotes are not interpreted as such, but as being in your parameters. You think you've executed this: find /etc -name 'shells' When in fact you've executed this: find /etc -name \'shells\' Keep it in mind: In bash, simple quotes inside double quotes are not ignored. So the solution is to not put any simple quotes: ...


1

try eval find /etc $SEARCH eval will eval the line after variable expansion


0

Try the -name option like this : SEARCH="shells"; find /etc -name $SEARCH Take a look at this question for some options.


1

Be careful when using the above solutions, I used them and ended up moving all files in all subfolders!!!! This command moves all files in /source directory and all subfolders under source directory: find /sourcedirectory -mtime +365 -exec mv "{}" /destination/directory/ \; Instead, use option -maxdepth 1 for only files in /sourcedirectory find ...



Top 50 recent answers are included