Need an explanation on \; and the end of commands

SpongeB0B

Member
Joined
Feb 11, 2022
Messages
30
Reaction score
7
Credits
270
Hi everyone,

I would like to know exactly what does
Bash:
\;

at the end of the example that I saw online

example 1
Bash:
find /var/log -name *.log -exec ls -l {} \;

So If I get it well
Find will look in /var/log for files named *.log then will execute ls -l on each result ( {} = the output list ? )

I've try without \; at the end and I get Find: missing argument to -exec why ?

why we need to escape and and ; ?

Thanks
 


SlowCoder

Gold Member
Gold Supporter
Joined
May 2, 2022
Messages
455
Reaction score
316
Credits
3,611
It denotes the end of the exec argument.

 

osprey

Well-Known Member
Joined
Apr 15, 2022
Messages
913
Reaction score
856
Credits
8,655
The link provides useful info, but the semi-colon is escaped essentially so that the find command reads it and so it's not interpreted separately by the shell.
 

Staff online

Members online


Top