No idea what's happening here. I am on Bash 3.2 on a Mac. I have:
ores_resource(){
for f in "$(cd "$HOME/.oresoftware/bash" && find . -type f)"; do
f="${f:2}"
echo "my file $f"
done;
}
I get this echoed out:
my file r2g.sh
./fame.completion.sh
./read_json.sh
./nlu.sh
./lmx.sh
./public-bash-utils.sh
./run-tsc-if.sh
./r2g.completion.sh
./fame.sh
./waldo.sh
./nlu.completion.sh
so what the heck is going on here - I thought it would log out "my file" in front of each of the lines?
"$(cd "$HOME/.oresoftware/bash" && find . -type f)"
is a single string: see Bash Pitfall #1 and Why is looping over find's output bad practice? – steeldriver Jul 11 '19 at 21:39xargs
command or--exec
option. – ctrl-alt-delor Jul 11 '19 at 21:42