I expect the command
ls -d doc/* | grep -P "<some_pattern>" | xargs bash -ic echo
to do the same as:
ls -d doc/* | grep -P "<some_pattern>" | xargs echo
that is, to give me the files matched by ls -d doc/* | grep -P "<some_pattern>"
, only separated by spaces instead of newlines.
But I get only a newline as output instead.
Why is this? How can I fix the first command to do what I want?
By the way, I’m realling using zsh
instead of bash
, but neither will work.
I actually need this to print a bunch of files whose file names are matched by the pattern specified by "grep" and should be printed using an .zshrc
-aliased command.