This works for me:
$> find . -name "*.log" -exec basename '{}' \;
20160114.log
20160115.log
20160116.log
20160117.log
20160118.log
Is the
{}
,\
and ';' mandatory when using-exec
as any other syntax simply doesn't work?The following, more complex example doesn't work:
$> find . -name "*.log" -exec echo $(basename '{}') \; ./log/20160114.log ./log/20160115.log ./log/20160116.log ./log/20160117.log ./log/20160118.log
echo
here is just to demonstrate. I eventually plan to use something likerm $TARGET_DIR/$(basename '{}')
in its place… It just doesn't work that way (nesting). Any ideas?