2 directories showing same name


Forum: Other Help Topics
Topic: 2 directories showing same name
started by: john.martzouco

Posted by john.martzouco on Dec. 08 2007,17:45
Maybe this is normal for Linux, or for ndiswrapper, please excuse me if it is:

I've installed ndiswrapper twice.  The first was a couple of weeks ago, I think I spec'd a wpa file for that one.  The second was this morning.

When I console to /etc/ndiswrapper and execute ls -al, I see two directories with exactly the same name.  After I deleted the first one (rm folder -R), navigating to the second one with cd showed me that the second one, that is the older one, is really named folder^M.  This happens because cd autoexpands to cd folder^M/ while I make the change.  Once inside the folder, the console prompt does not show the ^M any more.

Is this normal?  How come the cd command shows the extra characters but neither ls nor the prompt do?

And now my console cursor is staying at the first character in the prompt instead of at the the end.  I'm signed in as root, so my prompt looks like # oot@box:/etc/ndiswrapper/folder and the cursor is where the first and only blank shows up in the prompt.

Am using 4.1RC3 HD installed traditionally.

Posted by ^thehatsrule^ on Dec. 09 2007,01:30
How did that folder get created?
Afaik ^M is the carriage return character, which is a newline... so it just happens that your shell prompt parses this, so you end up with your cursor at the next line.

Posted by john.martzouco on Dec. 09 2007,01:54
I don't know.  I ran ndiswrapper -i a couple of times, and there they were.
Posted by ^thehatsrule^ on Dec. 09 2007,02:25
Hm, it probably tries to get the filename from some .inf files that have the CR character.  Probably nothing to be worried about.
Posted by john.martzouco on Dec. 09 2007,03:36
Not worried, but it's confusing to see twin folder names... especially when one of them is misrepresented.
Posted by mikshaw on Dec. 09 2007,15:06
The ^M character is not uncommon if you tend to switch between Windows and Linux a lot. If you edit a file in Windows it will insert ^M whenever you add a line break. If you stick with Linux exclusively, or don't use Windows to edit files, you will likely never see this issue.

^M is technically a non-printing character. Some applications handle it differently than others. As ^thehatsrule^ suggested, your terminal most likely interpreted it as a line break rather than a printable character, so it made a new line rather than displaying it in text.

Posted by john.martzouco on Dec. 09 2007,15:11
Thanks mik, that's a very helpful answer.

Yes, I was aware that Linux and MS use different EOL characters; that MS uses 2 and Linux only 1.  I've faced the opposite issue before; dealing with a Linux file under MS.  Now I know to be more careful in this direction as well.

Plenty of thanks,
John

Posted by mikshaw on Dec. 09 2007,17:43
Some text editors for Windows, such as UltraEdit (a commercial product), have a built-in feature to convert between DOS and UNIX format, and will edit a file in UNIX format if it is already in UNIX format. I wouldn't be surprised if there are free/open-source editors that will do this too. This can be very useful for editing Linux files in Windows, especially as the Linux dos2unix command has an annoying habit of changing file permissions when it converts a file.
Posted by lucky13 on Dec. 09 2007,18:37
Quote
I wouldn't be surprised if there are free/open-source editors that will do this too.

Such as (g)vim.
< http://www.vi-improved.org/wiki/index.php/FileFormat >

Posted by humpty on Dec. 09 2007,19:42
beaver can do the conversion too.
Posted by john.martzouco on Dec. 09 2007,20:27
Quote (mikshaw @ Dec. 09 2007,12:43)
Some text editors for Windows, such as UltraEdit (a commercial product), have a built-in feature to convert between DOS and UNIX format, and will edit a file in UNIX format if it is already in UNIX format.

I use < Multi-Edit >, it has the ability to seamlessly work with Linux files.  Greatest editor ever produced.  :~)
Posted by roberts on Dec. 09 2007,23:39
Don't forget the command line

dos2unix

I occasionaly need to run this on submitted .info files where every line ends with ^M

Posted by mikshaw on Dec. 10 2007,03:10
Quote
especially as the Linux dos2unix command has an annoying habit of changing file permissions when it converts a file.
Although I was mainly pointing toward a solution that would prevent the ^M from being created in the first place, while the user is in Windows.

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.