Visit Our UNIX and Linux User Community


i see "{}" in various commands around here what is there funtion?


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers i see "{}" in various commands around here what is there funtion?
# 1  
Old 06-06-2001
i see "{}" in various commands around here what is there funtion?

IE:

find / -type f -exec grep email@host {} /dev/null \;
or
find /home/domains/*/ -type d -exec chmod 777 {} \;


is the {} \; part of the -type funciton?

this is what i understand about the following commands.

1) start the find at the root dir.
a) only looking for flatfiles
b) grep for email@host in any matches from the find
?c?) the output for the find fills the namespace {}?
d) /dev/null is used to so the output of the whole command lists filename then search pattern
e) \; why the backslash the line is not continueing and why they semi-colon.


Last edited by Optimus_P; 06-06-2001 at 01:33 PM..
# 2  
Old 06-06-2001
Re: i see "{}" in various commands around here what is there funtion?

Quote:
Originally posted by Optimus_P
IE:


?c?) the output for the find fills the namespace {}?

e) \; why the backslash the line is not continueing and why they semi-colon.

c) correct: the {} gets replaced with each filename that 'find' finds. (!)

e) 'find' commands always have to be terminated with a semi-colon. Since most (all?) shells interpret that as a special character, it has to be escaped with a slash.

HTH
# 3  
Old 06-06-2001
i didnt know that it always has to end in a semi-colon.

on sol 6 and 7 using ksh shell i always just type

find . -name search-pattern -print
# 4  
Old 06-06-2001
You are right. I meant to say that when you use the "-exec" option it has to end in a semi-colon.
# 5  
Old 06-06-2001
thanks for the explination.
 

Previous Thread | Next Thread
Test Your Knowledge in Computers #302
Difficulty: Easy
The GNU website is the official repository for Slackware.
True or False?

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Howto auto boot SPARC | How to auto supply "start /SYS" and "start /SP/console" commands

When I power ON my T4-1, I got a prompt -> where I have to start /SYS and start /SP/console. How can I auto supply these two commands ? (3 Replies)
Discussion started by: z_haseeb
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. UNIX for Beginners Questions & Answers

Extract delta records using with "comm" and "sort" commands combination

Hi All, I have 2 pipe delimited files viz., file_old and file_new. I'm trying to compare these 2 files, and extract all the different rows between them into a new_file. comm -3 < sort file_old < sort file_new > new_file I am getting the below error: -ksh: sort: cannot open But if I do... (7 Replies)
Discussion started by: njny
7 Replies

4. Red Hat

files having Script which works behind "who" & "w" commands

Dear All, plz print the path of files which have the script of "who" & "w" commands. thnx in advance. (6 Replies)
Discussion started by: saqlain.bashir
6 Replies

5. Solaris

Relation btw commands, "man" and "more" ???

Hi guys, Hope u r doing find. I have this query. When we check the manual pages for a certain command, say man cat we see the manual page with more What is UNIX really doing here, I mean why not less command instead of more command. And can we have UNIX display the manual pages with less command... (2 Replies)
Discussion started by: gabam
2 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. OS X (Apple)

Neither "which" nor "find" commands work

hi there, could use some basic PATH advice, i think, or something find sometimes work, but which hasn't ever seemed to. for years! what am i doing wrong that the commands which and find rarely work? they used to work on the workstations i used ages ago... running 10.5.8 because i... (4 Replies)
Discussion started by: zensnob
4 Replies

8. Shell Programming and Scripting

Unix commands delete all files starting with "X" except "X" itself. HELP!!!!?

im a new student in programming and im stuck on this question so please please HELP ME. thanks. the question is this: enter a command to delete all files that have filenames starting with labtest, except labtest itself (delete all files startign with 'labtest' followed by one or more... (2 Replies)
Discussion started by: soccerball
2 Replies

9. UNIX for Dummies Questions & Answers

"nohup" and "&" commands

Why would anyone ever type in a command like this: nohup command & nohup lets you logout of your telnet session so why add "&" to run it in the background? (1 Reply)
Discussion started by: xadamz23
1 Replies

10. UNIX for Advanced & Expert Users

Commands on Digital Unix equivalent to for "top" and "sar" on other Unix flavour

Hi, We have a DEC Alpha 4100 Server with OSF1 Digital Unix 4.0. Can any one tell me, if there are any commands on this Unix which are equivalent to "top" and "sar" on HP-UX or Sun Solaris ? I am particularly interested in knowing the CPU Load, what process is running on which CPU, etc. ... (1 Reply)
Discussion started by: sameerdes
1 Replies

Featured Tech Videos