Strange charactes in directory name

Strange charactes in directory name

Post by Mat » Fri, 30 Aug 2002 03:49:28



I have a Red Hat 7.2 Linux box.

I wrote a bash shell script that consists of the following:

mkdir /mirror
mkdir /mirror/qdls

When I run it, I get the following error message:

mkdir:  cannot create directory '/mirror/qdls\r': No such file or directory.

It creates a "/mirror?" directory ( with a question mark on the end )

I've created this shell program with the vi editor, and this is
very puzzling.

Why the characters on the end of the /mirror directory?

Thanks,

Matt

 
 
 

Strange charactes in directory name

Post by Andrew Taylo » Fri, 30 Aug 2002 04:21:49



> When I run it, I get the following error message:

> mkdir:  cannot create directory '/mirror/qdls\r': No such file or directory.

> It creates a "/mirror?" directory ( with a question mark on the end )

It looks like your shell script has DOS line terminators - i.e. \r\n
instead of just \n at the end of each line.  This usually happens if the
shell script is created on a DOS/Windows machine.  It shouldn't happen
with vi, although it will preserve them if they already exist.  vim will
show [dos] on the status bar when it loads such a file.

You can easily strip them off with 'tr -d '\r' < script > script.out &&
mv script.out script'.

Andrew

 
 
 

1. Strange Directory Name

I found today that I managed to get myself 2 . entries in my directory.  
I ran the find program on it and it looks like one is a directory called
/home/fallsk/.^C  How can I change to that directory?  Thanks for your help!

P.S.  I am running Solaris 2.3.  Please reply via e-mail.

Thanks again!

Keith Falls

2. Help with utility identification..

3. strange directory name - help!

4. xterm and cron

5. cd to a directory with a whitespace in the directory name

6. fixed frquency monitors

7. Script that recurses through all directories tries to check file/directory named "*"

8. ftp Logging ?

9. Remove directory name from file name (bash scripting)

10. cd to a directory with a whitespace in the directory name

11. Strange, strange, strange...

12. C, Bash, and X: Strange, strange, strange

13. Host name, primary name, domain name...?