linux 常见错误

一、shell脚本执行报错exec format error解决

     原因可能是脚本里#!/bin/bash和#!/bin/sh兼容问题导致,标准系统支持的都是/bin/bash;

1) 检查 脚本头部是否 是 #! 开始的

2)   检查当前 系统用的是 bash 还是 dash。

首先查看当前系统的bash或dash:

[root@localhost ~]# ls -l /bin/bash
-rwxr-xr-x. 1 root root 960608 Sep 6 2017 /bin/bash

如果只有dash,则需要做软连接:

ln -s /bin/dash /bin/bash

确认shell脚本中使用的是#!/bin/bash还是#!/bin/sh,如果是#!/bin/sh修改替换为#!/bin/bash

参考:

https://blog.csdn.net/aixueai/article/details/115002798?utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-6.no_search_link&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7Edefault-6.no_search_link

原文地址:https://www.cnblogs.com/sandyflower/p/15509782.html