Visit Our UNIX and Linux User Community


Using "find" and "-exec rm" ... Just no luck :(


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Using "find" and "-exec rm" ... Just no luck :(
# 29  
Old 08-29-2009
What we need is anybody who is still running DYNIX or DRS/NX just to prove a point.
# 30  
Old 08-29-2009
ok, found (not very common) one. The fish shell requires quotes.

Code:
~> touch testfile
~> find . -type f -name testfile -exec echo . {} . \;
.  .
~>  find . -type f -name testfile -exec echo . "{}" . \;
. ./testfile .

# 31  
Old 08-29-2009
Quote:
Me too, I'm running through some old shells to see if I can find one that treats an empty {} as special.
Hopefully you have access to Sunos 4.1.1 with Berkeley shell. I cited this O/S earlier because I had created a comment line in an old script about fixing the "{}" problem.[COLOR="#738fbf"]

---------- Post updated at 12:33 AM ---------- Previous update was at 12:29 AM ----------

I have never heard if the "fish" shell. Must have led a sheltered life in deep water under the rocks. Pound-to-a-penny it's a Berkeley derivative.

Last edited by methyl; 08-29-2009 at 08:32 PM.. Reason: Updates not in chronological order
# 32  
Old 08-30-2009
Quote:
Originally Posted by methyl
I cannot believe that I am the only person to have encountered problems with unix commands dealing with space characters in filenames.
Unix commands generally do not have problems with space characters in file names. The main exceptions are the commands that both parse their input and expand meta-characters in it. That includes mainly shell interpreters. So yes, there are a lot of issues with shell scripts and space characters in filenames. One way to overcome them has always been to use find and {}.
Quote:
The question still remains: Why have I seen the "{}" problem before?
The only reasonable explanation is you have been fooled by something else, didn't double check and stayed with that believing.
Quote:
I am exploring Reborg's ideas which imply that some older shells were eating the {}. If proven, this would explain it.
Older shells were all based on the original Bourne shell. Then came the C-shell, the Korn shell and later their open source clones and more or less innovative variants. I never heard of any of them handling {} a specific way.
Quote:
I don't have access to the source code to the various editions of "find" - unlike when I was working on enhancements to RSX.
As I wrote a couple of time, the find command itself has nothing to do with it as it does receive the very same parameter whether you quote {} or not.
# 33  
Old 08-30-2009
Point taken I understand what is supposed to happen but it would be interesting to know why it sometimes does not work.


Looks like I am not the only one who quotes '{}' .
See this recent post.

https://www.unix.com/shell-programmin...directory.html
# 34  
Old 08-30-2009
Quote:
Originally Posted by methyl
it would be interesting to know why it sometimes does not work.
This is still unproved (and unprovable IMHO).
Quote:
Looks like I am not the only one who quotes '{}' .
See this recent post.

https://www.unix.com/shell-programmin...directory.html
Sure, you aren't alone doing this. These extra quotes are harmless and not at all scripting error however, technically, they serve no purpose.
# 35  
Old 08-31-2009
thanks for sharing ur knowledge

***REMOVED***

Last edited by reborg; 08-31-2009 at 07:26 PM.. Reason: Remove attempt to redirect traffic.
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #152
Difficulty: Easy
In 1995, Novell transferred the Unix trademarks to the ACME Computing Company.
True or False?

9 More Discussions You Might Find Interesting

1. AIX

Apache 2.4 directory cannot display "Last modified" "Size" "Description"

Hi 2 all, i have had AIX 7.2 :/# /usr/IBMAHS/bin/apachectl -v Server version: Apache/2.4.12 (Unix) Server built: May 25 2015 04:58:27 :/#:/# /usr/IBMAHS/bin/apachectl -M Loaded Modules: core_module (static) so_module (static) http_module (static) mpm_worker_module (static) ... (3 Replies)
Discussion started by: penchev
3 Replies

2. Shell Programming and Scripting

Bash script - Print an ascii file using specific font "Latin Modern Mono 12" "regular" "9"

Hello. System : opensuse leap 42.3 I have a bash script that build a text file. I would like the last command doing : print_cmd -o page-left=43 -o page-right=22 -o page-top=28 -o page-bottom=43 -o font=LatinModernMono12:regular:9 some_file.txt where : print_cmd ::= some printing... (1 Reply)
Discussion started by: jcdole
1 Replies

3. Shell Programming and Scripting

find . -path "*_nobackup*" -prune -iname "*.PDF" \( ! -name "*_nobackup.*" \)

These three finds worked as expected: $ find . -iname "*.PDF" $ find . -iname "*.PDF" \( ! -name "*_nobackup.*" \) $ find . -path "*_nobackup*" -prune -iname "*.PDF" They all returned the match: ./folder/file.pdf :b: This find returned no matches: $ find . -path "*_nobackup*" -prune... (3 Replies)
Discussion started by: wolfv
3 Replies

4. UNIX for Dummies Questions & Answers

Using "mailx" command to read "to" and "cc" email addreses from input file

How to use "mailx" command to do e-mail reading the input file containing email address, where column 1 has name and column 2 containing “To” e-mail address and column 3 contains “cc” e-mail address to include with same email. Sample input file, email.txt Below is an sample code where... (2 Replies)
Discussion started by: asjaiswal
2 Replies

5. Shell Programming and Scripting

Find lines with "A" then change "E" to "X" same line

I have a bunch of random character lines like ABCEDFG. I want to find all lines with "A" and then change any "E" to "X" in the same line. ALL lines with "A" will have an "X" somewhere in it. I have tried sed awk and vi editor. I get close, not quite there. I know someone has already solved this... (10 Replies)
Discussion started by: nightwatchrenba
10 Replies

6. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

7. Shell Programming and Scripting

cat $como_file | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g'

hi All, cat file_name | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g' Can this be done by using sed or awk alone (4 Replies)
Discussion started by: harshakusam
4 Replies

8. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

9. UNIX for Dummies Questions & Answers

No utpmx entry: you must exec "login" from lowest level "shell"

Hi I have installed solaris 10 on an intel machine. Logged in as root. In CDE, i open terminal session, type login alex (normal user account) and password and i get this message No utpmx entry: you must exec "login" from lowest level "shell" :confused: What i want is: open various... (0 Replies)
Discussion started by: peterpan
0 Replies

Featured Tech Videos