Need an explanation on \; and the end of commands

SpongeB0B

New Member
Joined
Feb 11, 2022
Messages
28
Reaction score
7
Credits
258
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
456
Reaction score
313
Credits
3,611
It denotes the end of the exec argument.

 

osprey

Member
Joined
Apr 15, 2022
Messages
77
Reaction score
43
Credits
672
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.
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Linux.org Hosting Donations
Consider making a donation

Members online


Top