The file XXX is marked as an executable but could not be run by the operating system

更新日期: 2019-03-21 阅读次数: 11976 字数: 146 分类: Shell

fish shell 中执行我自己写一个 shell 脚本时,报错

> lazy
Failed to execute process '/home/zhongwei/bin/lazy'. Reason:
exec: Exec format error
The file '/home/zhongwei/bin/lazy' is marked as an executable but could not be run by the operating system.

lazy 中的代码很简单,就是一行,为了我自己偷懒时使用

> cat ~/bin/lazy
git commit -a -m"update"

我猜测是 fish shell 中必须指定 shell 名称。

修改成

> cat ~/bin/lazy
#!/bin/bash

set -e  # or use "set -o errexit" to quit on error.
set -x  # or use "set -o xtrace" to print the statement before you execute it.

git commit -a -m"update"

就一切正常了。

微信关注我哦 👍

大象工具微信公众号

我是来自山东烟台的一名开发者,有感兴趣的话题,或者软件开发需求,欢迎加微信 zhongwei 聊聊, 查看更多联系方式