Problem with linux debian Ansible

Hi all,

I have Debian linux 8.11 (jessie) with Ansible.

My problem is that i have two repertory :

repertoire
repertoire?

The repertory repertoire? it was created since windows so there is surely the character ^M

when i try open this content with command line “cd repertoire?” i get a carriage return

I need this repertory for use in ansible.

Someone have an idea please !!?

Thanks community ansible :wink:

Regards,

I’m not sure what you mean by “I get carriage return”. Do you mean that when you issue (from the parent directory) the command “cd repertoire?” (that’s an actual question mark) the cursor drops down one line, then to the far left of the window? If so, it looks like you have somehow managed to create a directory called “repertoireM” where M is an actual carriage return.

It is harmless - when in that directory, the remains of your command prompt will appear to the right of the cursor and be overtyped by whatever you type, but they will have no other effect.

If you do not want to have that carriage return in the directory name, just rename the directory:

mv repertoire? repertoireX

Or whatever name you want instead of repertoireX.

Alternatively, edit your command prompt. Set PS1 to whatever it is now, but get rid or or replace “\w”. That is the bit that is being replaced by the working directory name and causing the carriage return to be displayed. You can set PS1 locally (just in the current terminal) and it will apply only to the current window and will be reset when you close that window. If you want the change to be permanent, edit ~/.bashrc, look for where PS1 is set, and make the change there. It won’t take effect until .bashrc is run again, of course.

Regards, K.

Hi Karl Auer,

First, thank you very much for your answer complet Mister Karl Auer :slight_smile:

Exactly, the cursor drops down one line, then to the far left of the window.

I would like on issue without rename the name of directory. I would like only open this repertory but i don’t find in internet :frowning:

Regards,

I’m puzzled, why do you want a directory with a carriage return in its name?

Anyway - some programs (like ls) will convert control characters to question marks. But most don’t, and your prompt string ($PS1) does not. To avoid seeing the carriage return in your prompt, you will have to change your prompt so it does not contain the working directory. For example, substitute this for the last occurrence of “\w” in your PS1 variable:

$(pwd | tr -d \r\n)

That will just remove carriage returns and linefeeds from the directory name. It will prevent the carriage returns displaying, but you will be unable to tell the difference between repo and repo^M in your prompt.

Note that when you do “cd repo?” or “cd repo^M” (you can get “^M” by pressing CTL-V then CTL-M), you do actually change into the directory! You just don’t see its name in the prompt. And because “pwd” will not transcode carriage returns, it is hard to see what directory you are in. You can do this to check what directory you are in:

pwd | od -a

Aside from these output oddities, the directory can be used in the same ways as any other directory.

Regards, K.

Hi,

I have this directory but it’s from windows create it in my linux.

In fact, when i write repo + CTL-V then CTL-M i can open this repertory but the curseur is at left and not a right do you understand ?

Thanks for your help Karl !! :wink:

Regards,

Yes, I do understand, and this is a problem you will contiue to have unless you rename the directory.

The problem is harmless - you can still use the directory, it will just screw up your command prompt.

Unless there is some reason why you cannot rename the directory, you should rename it to something more standard. Having control characters in directory names is not good practice.

Regards, K.

Hi,

Okay, Thanks for you help Karl !! :slight_smile:

I will going rename this directory and i think that will works :wink:

You are very strong you will work at Microsoft in California Karl ! :wink:

Thanks very much,

Regards,