LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Solaris / OpenSolaris (https://www.linuxquestions.org/questions/solaris-opensolaris-20/)
-   -   "No such file or directory" even though the file is there (https://www.linuxquestions.org/questions/solaris-opensolaris-20/no-such-file-or-directory-even-though-the-file-is-there-847786/)

Ashkhan 12-01-2010 05:30 PM

"No such file or directory" even though the file is there
 
Hi guys,

I'm working on a simple bash script which collects data upon a request from a db and outputs the result into a file. The file is then uploaded to a different server for further processing.

The file name is stored in a variable, the file is created but I can't access it again. The filename is db_export_timestamp. When I print the contents (only the exports actually) of the directory I can see something like this:

Code:

ls /export/db/db_export_*
/export/db/db_export_101201_235909  /export/db/db_export_101202_000543

There are two files. The * is properly expanded by the shell. However, adding just another character, the 1, the filename no longer matches anything.

Code:

ls /export/db/db_export_1*
/export/db/db_export_1*: No such file or directory

Also accessing the file directly by its filename doesn't work.

On the other hand, using the bash TAB auto-completion feature works. The file exists then. When I rerun the same command, deleting the last character and typing it again, it doesn't work anymore.

I see no reason why the file is not found by the filesystem. There are no illegal or invisible characters, the file exists, the same variable is used to create the file as it is to access it..

Does anybody have any clue?

Thx in advance.

kbp 12-01-2010 06:25 PM

Are you sure there are no control chars ? 'ls -lq /export/db/'

Ashkhan 12-02-2010 02:52 AM

Thanks for the q switch kbp. There are indeed non-printable characters in the filenames. No idea where they came from but at least I know where to focus my attention now. My next step would've been to trace the commands..

I guess the problem can be considered solved.

edit: It has been caused by copy&pasting from Windows.


All times are GMT -5. The time now is 01:44 AM.