LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 12-01-2010, 05:30 PM   #1
Ashkhan
Member
 
Registered: Oct 2003
Distribution: Debian, Ubuntu, RHEL, CentOS, MacOS
Posts: 39

Rep: Reputation: Disabled
Post "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.
 
Old 12-01-2010, 06:25 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Are you sure there are no control chars ? 'ls -lq /export/db/'
 
1 members found this post helpful.
Old 12-02-2010, 02:52 AM   #3
Ashkhan
Member
 
Registered: Oct 2003
Distribution: Debian, Ubuntu, RHEL, CentOS, MacOS
Posts: 39

Original Poster
Rep: Reputation: Disabled
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.

Last edited by Ashkhan; 12-07-2010 at 04:55 PM. Reason: Added cause
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
File Exists but... "-bash: No such file or directory" zachet Linux - Newbie 24 03-20-2016 01:13 AM
"bad interpreter : no such file or directory" when configure "flex" acer_peri Linux - Software 10 11-10-2010 01:19 AM
Hostname defined in file "network" changes after change to file "hosts" qwkfish Linux - Networking 2 10-14-2009 04:07 PM
Error: "libdmx.so.1: cannot open shared object file: No such file or directory" ESC201 Linux - Software 4 11-01-2008 08:38 PM
"No such file or directory" on existing file G00fy Debian 1 09-06-2006 06:48 AM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 10:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration