I will not entertain the argument that all unix versions in use in the commercial environment are POSIX-compliant.
Just checked an old one:
It has come as a revelation to me that find can pass a parameter containing space characters to exec {} without quoting "{}" . The usual solution involves piping to "xargs", though in practice I don't use either method myself unless requested by a customer.
In case you are wondering I have tried it today on a couple of modern unix O/S and it works without the quotes.
On reflection, the POSIX versions are the anomaly.
I was expecting an interjection from cfajohnson, but "find" is an external command and not covered by the POSIX shell.
There are many unix commands which I would like to see standardised but these are mostly to do with memory mapping, disc partitioning, and printing. (Controversial statement) POSIX avoids hardware.
I'm not surprised about your tests that match my experience. That leave the question about what find version the open poster is using unanswered ...
---------- Post updated at 10:21 ---------- Previous update was at 08:50 ----------
Quote:
Originally Posted by Dean Rotherham
YOU GUYS ROCK!!! .. so the answer was the fact that the curly brackets needed quotes .. "{}" ..
I'm afraid your conclusion seems incorrect. After some research, I'm now convinced no known implementation of the find command need quotes. The idea they are required, even while documented in various web location, can't be but a urban legend.
In fact, using single or double quotes cannot have any effect on the find command given the fact the shell is removing them before passing the {} argument to the find command. Should you use a non standard shell that keep them, find behavior would be unspecified.
I thought I'd just confirm my OS, nothing abnormal and if anything probably one of the most common OS, I'm on ubuntu. (So guess Debian) ... I will confirm though that without the quotes it definately doesn't work. I'm running the script on 50+ remote pc's and I get the same result on ALL. SO, not sure .. Sorry, Hope I didn't start chaos here ... Chat soon and I'll keep my eyes here for what the final conclusion is?
Hi jlliagre. No urban legend. Hands on commercial experience of a very wide range of unix flavours and of their predecessors. Sometimes I only find out oddities when porting tried-and-tested scripts and they misbehave. I don't have "ubuntu" Linux handy though.
One SCO unix came with a standard cron to clean /tmp which failed if there were filenames containing spaces or there were lots of files. Sound familiar?
I'm not telling SCO scripts or any other ones can't be buggy, or course they can. I'm just telling I'm convinced using simple or double quotes around the {} in a find -exec statement does not and cannot have any effect. Of course it doesn't hurt to use them, just like the following commands works equally fine:
My point is these quote are unnecessary and not required regardless of the filename. I have no problem if you prove me wrong so feel free to demonstrate the quote are necessary with some OS, but do it with facts.
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)
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)
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)
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)
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)
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)
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)
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)