help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] Commands run via xargs and bash returns different results


From: Richard Taubo
Subject: [Help-bash] Commands run via xargs and bash returns different results
Date: Mon, 3 Feb 2014 00:50:18 +0100

Hi!

I am running the following command via xargs and bash with no problems;
        /usr/bin/mdfind text -0 -onlyin /This/Path | /usr/bin/xargs -0 -I {} 
bash -c 'echo -e "{}”;

When I switch to following command though, to better manipulate the results, 
most of the results from the earlier command above get returned, but some lines 
simply
returns  {} instead of the correct result:
        /usr/bin/mdfind text -0 -onlyin /This/Path | /usr/bin/xargs -0 -I {} 
bash -c 'my_path="{}";echo -e "$my_path”;'

It seems like the added step of including a variable hinders the mdfind command 
to return the real result, so it skips a few paths here and there.

Is there a better way to go about this, so I can be sure that the equivalent of 
the last command 
returns the same as the first command?

Thanks!

Richard Taubo


reply via email to

[Prev in Thread] Current Thread [Next in Thread]