Click to See Complete Forum and Search --> : Linux Guru Assistance Required


Sepero
04-27-2003, 04:26 AM
Just when I thought I had it all figured out...

Ok, I have 2 scripts. One called "test", one called "test2". Both of them contain the same text:#!/bin/bash
echo "hi"Both of them have the same attributes.#ls -l test test2
-rwxrw-rw- 1 root root 23 Apr 26 20:06 test*
-rwxrw-rw- 1 root root 26 Apr 26 20:15 test2*
#lsattr test test2
-------------- test
-------------- test2"test" works fine. "test2" returns:bash: ./tools/wineinstall: /bin/bash
: bad interpreter: No such file or directory


The reason why is because "test2" was originally copied from a NTFS filesystem. But! That doesn't explain how to correct this problem. I have a LOT of files in this condition. Can anyone tell me how to correct these files?

EDIT[4-27-03]:
I am using a ext2 fs.
And YES, I did check to make sure there was no carriage return at the end of the lines. PLEASE HELP :)

bwkaz
04-27-2003, 09:07 AM
Run dos2unix on them.

It's not the CR or whatever at the end of the file, it's the CR right before the LF on the first line. I bet if you open it up in gvim, you'll see a bunch of ^M characters sprinkled throughout.

dos2unix gets rid of these. If you can't find it, I can post source for a version I wrote.

Sepero
04-27-2003, 09:23 AM
Originally posted by bwkaz
Run dos2unix on them.

It's not the CR or whatever at the end of the file, it's the CR right before the LF on the first line. I bet if you open it up in gvim, you'll see a bunch of ^M characters sprinkled throughout.

dos2unix gets rid of these. If you can't find it, I can post source for a version I wrote. Thanks bwkaz,
I just did "diff" on the files and there does seem to be a difference at the end of the line. I was just coming back to delete this post since I somewhat figured it out. I'm glad you posted though. Now I know what tool to use to get rid of this crap. :D

I won't delete this post, just incase anyone else may have this prob in the future. thanx again

Sepero
04-27-2003, 07:12 PM
Dang, I feel like an idiot now. I said it wasn't the carriage return, but it was. The reason I thought it wasn't the carriage return was because I didn't see it with VI.

On my comp I thought VI pointed to VIM. WRONG! It pointed to elvis. I'm so ticked I feel like deleting this freakin program. I also should have known by the different file sizes but I wasn't even paying attention.... Please, just shoot me now.

chrism01
04-28-2003, 01:24 PM
You had me going there also; vi should show those extra chars. I couldn't understand why you couldn't see them. My faith in vi is restored :)