search

Home  >  Q&A  >  body text

linux - When executing a shell script, it prompts "No such file or directory"?

1. Transfer the SHELL file written under Windows to Linux for execution, and an error message will appear.
2. Error message: bad interpreter: There is no such file or directory.

習慣沉默習慣沉默2749 days ago1103

reply all(5)I'll reply

  • 習慣沉默

    習慣沉默2017-05-16 13:34:13

    There are differences in line breaks and so on in different systems. It should be caused by different invisible characters. Find a conversion tool, or most editors can do this, and just convert some characters.

    reply
    0
  • 怪我咯

    怪我咯2017-05-16 13:34:13

    Screenshots
    Errors and codes

    reply
    0
  • PHP中文网

    PHP中文网2017-05-16 13:34:13

    Does your file path contain Chinese characters? If it contains Chinese characters and your shell script is gbk encoded, the file or directory will not be found, because Chinese file and directory names under Linux are UTF-8 encoded.

    reply
    0
  • PHP中文网

    PHP中文网2017-05-16 13:34:13

    You can consider using the following command to convert the carriage return under Windows to the carriage return under Linux, and try running it again

    # dos2unix xxx.sh

    reply
    0
  • 阿神

    阿神2017-05-16 13:34:13

    It always feels like there is no execution permission problem,
    Try itchmod 755 xxx.sh

    reply
    0
  • Cancelreply