When running Ripgrep normally in Bash, the output is formatted as follows:
$ rg asdfghjkl
my_file
1:asdfghjkl
But if I attempt to capture the output with $()
, the format is different:
$ foo=$(rg asdfghjkl)
$ echo "$foo"
my_file:asdfghjkl
What causes this disparity? Is Ripgrep changing its behaviour, or does $() not really capture stdout?
My best guess is that Ripgrep is the issue rather than Bash, though I've not been able to find anything documenting this behaviour.