|
|
|
|
|
by herdrick
5119 days ago
|
|
Why does xargs under fish not accept {} as a replstr like it does with bash? find . | xargs -I {} grep pat {}
On OS X fish this gives "xargs: replstr may not be empty" and on Linux fish I get "xargs: command too long". Using % as the replstr for example does work though. |
|
In fish you could do this:
... or this: The first example would work correctly in fish, but AFAIK it wouldn't work in bash. The is because every line from the command substitution is automatically escaped and quoted in fish. The small drawback is that a symbol-heavy commandline sometimes needs a few extra \ escapes - the power to handle lists of lines (i.e. lines from stdin or from command substitution) is bought for a little extra escaping. And it's a good deal IMO.And the for loop in fish is so elegant and convenient that it's worth using for small random stuff.
(Everything I say is pending that I understand the find/xargs/grep example!)