I have an issue I don't understand. It is simple and it should work, but it doesn't. =EDITED exactly what I can see from terminal= I have a list of filenames:
[molni@archlinux picasa_album]$ cat LIST
IMG_9282.JPG
IMG_9287.JPG
IMG_9300.JPG
IMG_9324.JPG
IMG_9329.JPG
IMG_9463.JPG
IMG_9412.JPG
IMG_9562.JPG
IMG_9511.JPG
IMG_9607.JPG
and want to search for every file in list it's path via find command:
[molni@archlinux picasa_album]$ for i in `cat LIST`; do find /mnt/c/e-m10/ -name "$i"; done
[molni@archlinux picasa_album]$
no results, when I exchange it for echo $i (to check if variable $i is OK, it works)
[molni@archlinux picasa_album]$ for i in `cat LIST`;do echo "$i" ; done
IMG_9282.JPG
IMG_9287.JPG
IMG_9300.JPG
IMG_9324.JPG
IMG_9329.JPG
IMG_9463.JPG
IMG_9412.JPG
IMG_9562.JPG
IMG_9511.JPG
IMG_9607.JPG
[molni@archlinux picasa_album]$
when I do it manually, set variable (without loop) it works:
[molni@archlinux picasa_album]$ i=IMG_9607.JPG
[molni@archlinux picasa_album]$ find /mnt/c/e-m10/ -name "$i"
/mnt/c/e-m10/IMG_9607.JPG
[molni@archlinux picasa_album]$
What am I doing wrong?
file LIST
– Sebastian Sep 19 '14 at 6:53for
and the$
in your result offind
. Please update the question with copy and paste the complete sequence as appears in your terminal. – Anthon Sep 19 '14 at 6:58for i in
cat LIST;do echo "$i" ABC; done
ascat LIST
would give the output you indicate as well. You could also have donefor i in
cat LIST; do echo find /mnt/c/e-m10/ -name "$i"; done
and try one of the commands with copy and paste. – Anthon Sep 19 '14 at 7:02