My aim is to get a list of files that have been modified in git
, then run rspec
command passing each file in as an argument.
Currently I have:
$ git status -s | awk '{if ($1 == "M") print $2}' | tr "\\n" "\\0" | \
xargs -0 -I % rspec -f documentation %
This technically works, but it runs rspec
for each modified file, I want it to run:
$ rspec path/to/file/1 path/to/file/2 ...
Anyone know how I can achieve this?
awk '/^ M / {print $2}'
(see examples) – ruvim Jun 07 '18 at 13:11