1

In a shell script (interpreter /bin/bash), the following works on Debian Squeeze:

find ~/bin/ '!' -type d -exec dos2unix {} \;

Now, I know that for some reason that dos2unix was renamed to fromdos in Ubuntu, so I'm trying to run:

find ~/bin/ '!' -type d -exec fromdos {} \;

Whilst this works on Debian, on Ubuntu it yields the output:

fromdos: Unable to access file todos.
fromdos: Unable to access file fromdos.

How do I get around this, and what is the problem?

2
  • Is the ~/bin/ mentioned exactly the same in both cases? Not just the same file list and contents, but the same underlying device/filesystem?
    – phogg
    Jan 25, 2011 at 15:11
  • ~/bin/ has the same file structure (and files) in both cases. find ~/bin/ '!' -type d by itself seems to do the same in both cases. Jan 25, 2011 at 15:23

1 Answer 1

2

On my Ubuntu system, /usr/bin/{{to,unix2}dos,dos2unix} are all symlinked to fromdos.

Try type -a fromdos to see if there's an alias, function or script that's overriding the binary in /usr/bin.

Also, try specifying the full path in your find command:

find ~/bin/ '!' -type d -exec /usr/bin/fromdos {} \;

Check to see if there's a broken symlink in your ~/bin directory. Are there any symlinked directories in ~/bin?

The error message you're getting looks like fromdos is trying to process a file called "fromdos".

3
  • dos2unix isn't a symlink on my install. type -a fromdos results in fromdos is /usr/bin/fromdos and find ~/bin/ '!' -type d -exec /usr/bin/fromdos {} \; results in the same error about not being able to find file todos/fromdos. There are no symlinks in ~/bin. Jan 25, 2011 at 19:44
  • @neurolysis: Does file /usr/bin/fromdos say "ELF..." or something else? What does fromdos -V (capital "V" - version) say? What kind of output do you get from your find command if you use the verbose option of fromdos (fromdos -v - (lower-case "v"))? Jan 25, 2011 at 20:06
  • Ah! It was indeed an error, caused by symlinking in a pretty deep subdirectory (no idea how it got there, don't remember doing it). Thanks anyway! :) Jan 25, 2011 at 20:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .