I've got a directory with a few .tiffs and for each of them I need to copy a file with the same name (but different extension) from another directory to this one. Here is the bash script I've made for this (I run it on the dir containing the .tiffs):
GT_PATH="~/source/";
for j in *.tiff; do
cp "$GT_PATH""${j%.tiff}".gt.txt .;
done;
However, this is what I get when I run it on a testing dir containing exclusively a file named test.tiff:
cp: cannot stat ‘~/source/test.gt.txt’: No such file or directory
Now comes the thing that is a little messed up: when I manually run cp ~/source/test.gt.txt .
, the file gets successfully copied!
What am I doing wrong?! Thanks in advance!