I'm trying to write a bash script that looks for a file in one directory and replaces it with one of the same name from a source directory. When I run the
find command, it seems to be setting my
for f in build-res/$1/*.png; do file="$(basename "$f")" echo "Looking for $file in $TMP" path="$(find $TMP -type f -name "$file")" if [[ -z $path ]]; then echo "Could not find $file in $TMP" else echo "Replacing file at $path with $file" echo "__path__" echo $path echo "---" fi done
Running one iteration of this loop outputs something like
Replacing file at tmp/trx//images/background/background_iphone5.png tmp/trx//images/background_iphone5.png with background_iphone5.png __path__ tmp/trx//images/background/background_iphone5.png tmp/trx//images/background_iphone5.png ---
Notice how path repeats itself with a space between. Why would this be happening?
Another note, why is it coming back with
// in the path as well? This doesn't seem to be an issue, more so just curious.