I needed to do something a bit more complex (such as chaining basename
and dirname
), and solved it by calling bash
on each filename, then using Bash subshells:
find "$all_locks" -mindepth 1 -maxdepth 1 -type d -exec bash -c 'basename $(dirname {})' \;
This solution allows using {}
multiple times, which is handy for more complex cases.