generating a multi-level directory shell last encountered a garbled directory mkdir -pa / b / c / d

The acquisition is completed using a shell from a configuration file path (matching characters), the process of generating a multi-stage path over the last encounter a directory garbled.

code show as below:

 

mkdir -p $path

The $ path is read from the configuration file.

How to solve:

1. Check whether the problem is the code itself

2. Check code format utf-8 Han like

3. Check the format of the configuration file, use the end of each line \ r, \ n is not the same, if the wrong can result in garbled!

  I have this problem is because of the configuration file carriage return or line feed caused. Because I wrote a shell script used in linux system, configuration file formats is a window format, we need to do is pass notepad ++ to convert the document format. see:

https://www.cnblogs.com/ivyharding/p/11252421.html

note:

Newline file: 
Linux, UNIX: \ r \ the n-            
Windows: \ the n-   
Mac OS: \ r

Guess you like

Origin www.cnblogs.com/ivyharding/p/11252299.html