ls or cp: cannot stat error

Cameron Simpson cs at zip.com.au
Thu Apr 26 08:06:03 UTC 2007


On 23Apr2007 12:23, Carl Reynolds <redhat-list at hyperbole-software.com> wrote:
| Eng KC wrote:
| >When I do a ls * like below
| >
| >[oracle at db]$ ls -l /data4/v5lmts/vin_group*
| >
| >I can see the file, but if I do a  ls /path/filename like below
| >
| >[oracle at db]$ ls /data4/v5lmts/vin_group3_add1.ora
| >ls: /data4/v5lmts/vin_group3_add1.ora: No such file or directory
| >
| 
| It looks as if you have an invisible character (like ' ') in the file 
| name. try something like
| 
|    $ ls /data4/v5lmts/vin_group3_add1.* | sed -e 's/^/</' -e 's/$/>/'
| 
| to see if the file has an extra space at the end.

This is shorter and more clear:

  ls -d /data4/v5lmts/vin_group3_add1.* | sed 's/.*/<&>/'

but I prefer this, myself:

  ls -d /data4/v5lmts/vin_group3_add1.* | sed -n l

Another incantation that's sometimes useful is:

  ls -d /data4/v5lmts/vin_group3_add1.* | od -c

Cheers,
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

Beware of bugs in the above code; I have only proved it correct, not tried it.
- Donald E. Knuth




More information about the redhat-list mailing list