shell脚本:standard_init_linux.go:211: exec user process caused “no such file or directory“

运行shell脚本出现standard_init_linux.go:211: exec user process caused "no such file or directory"异常。

第一种情况

  • shell脚本中使用#!/bin/sh,而非#!/bin/bash,虽然通常情况下,两种都可以执行脚本,但是如果使用docker容器来运行脚本,#!/bin/bash可能会出现这种异常。

第二种情况

  • shell脚本是在windows下编辑的,windows脚本的文件格式默认是dos,但是linux运行的脚本要求是unix

修改方式:其中fffileformat的缩写

  1. 使用vi查看shell脚本
  2. 输入:set ff查看脚本格式
  3. 输入:set ff=unix

猜你喜欢

转载自blog.csdn.net/qq_30038111/article/details/108144011