CodePudding user response:
Under Windows editor step01. Sh file?UE to Unix format
CodePudding user response:
$cat demo. Sh; Od - tx1 demo. Sh#!/bin/bash
Echo $0
23 21 2 f 0000000 62 61 73 62 69 6 e 2 f, 68 d 0 a, 65, 63, 68
0000020 6 f 20 24 30 0 d 0 a
0000026
$cat demo2. Sh; Od - tx1 demo2. Sh
#!/bin/bash
Echo $0
23 21 2 f 62 0000000 69 6 e 2 f, 62, 61, 73, 68 a, 65, 63, 68, 6 f
0000020 20 and 24 30 0 a
0000024
$./demo. Sh
- bash:./demo. Sh:/bin/bash ^ M: bad interpreter: No to the file or directory
$./demo2. Sh
./demo2. Sh
$
CodePudding user response:
: the set of ff=UnixCodePudding user response:
Vi script name: the set of ff=Unix
CodePudding user response:
This is due to enter under Windows and Unix newline character encoding to difference, use dos2unix have to do is to convert the format: dos2uinx step01. Sh,If often cross edit files on a Unix and Windows to install this tool will be more convenient,