I got the output value of the command (
$ (command)` ``), while receiving it with xargs
. I received a comment and corrected it so that it works correctly. In this example, we are checking the output value of the `` `basename command.
$ find . -name "*.txt" | xargs -I% sh -c 'echo "$(basename "%" .txt)"' a b $ ls . a.txt b.txt
while readI also tried using a loop.
$ find . -name "*.txt" | while read f; do echo "$(basename "$f" .txt)"; done a b