What is the purpose of braces after perl -e line

I know some real perl basics, and I used this one liner to rename files:

find . -type f -exec perl -e 'rename($_,lc) for @ARGV' {} \; 

The search transfers the list of files in perl to one liner, which then renames them lowercase, but what does {} mean for?

+6
source share
2 answers

The argument " {} " is part of the find command, not the perl command.

In locate the man page , the token ' {} ' is replaced with the name of the file being processed so that it can be used by the target of the arguments "exec", which in this case is " perl -e ... ".

+11
source

It comes from find and will be replaced by the name of the file (s). It will execute perl as:

perl -e 'rename($_,lc) for @ARGV' filename

+3
source

Source: https://habr.com/ru/post/895348/


All Articles