set variable with file name with space

Adel ESSAFI adelessafi at gmail.com
Tue Aug 31 21:59:34 UTC 2010


Hello
I have a problem (simple) with file name containing spaces.
I want to set a variable with a filename containing spaces. The file is the
most recent one in its directory.

I succeeded to set the variable, but when I used it, I get the following
error (which I have expected).

could you help to solde please.



adel at adel-laptop:~/boontoo$ FILE=`ls -1rt /mnt/movie/ | tail -1 `
adel at adel-laptop:~/boontoo$ echo $FILE
10-08-31 - O_ sport info - [1].ts
adel at adel-laptop:~/boontoo$ ls -l /mnt/movie/$FILE
ls: ne peut accéder /mnt/movie/10-08-31: Aucun fichier ou dossier de ce type
ls: ne peut accéder -: Aucun fichier ou dossier de ce type
ls: ne peut accéder O_: Aucun fichier ou dossier de ce type
ls: ne peut accéder sport: Aucun fichier ou dossier de ce type
ls: ne peut accéder info: Aucun fichier ou dossier de ce type
ls: ne peut accéder -: Aucun fichier ou dossier de ce type
ls: ne peut accéder [1].ts: Aucun fichier ou dossier de ce type



-- 
PhD candidate in Computer Science
Address
3 avenue lamine, cité ezzahra, Sousse 4000
Tunisia
tel: +216 97 246 706 (+33640302046 jusqu'au 15/6)
fax: +216 71 391 166
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20100831/a3c9080d/attachment.html>


More information about the ubuntu-users mailing list