Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
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 '11 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. –  Matthieu Cartier Jan 25 '11 at 15:23

1 Answer 1

up vote 2 down vote accepted

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".

share|improve this answer
    
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. –  Matthieu Cartier Jan 25 '11 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"))? –  Dennis Williamson Jan 25 '11 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! :) –  Matthieu Cartier Jan 25 '11 at 20:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.