在 sh shell 中找不到 source 命令 [英] source command not found in sh shell

查看:35
本文介绍了在 sh shell 中找不到 source 命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 sh shell 的脚本.我在使用 source 命令的行中收到错误消息.我的 sh shell 中似乎没有包含 source.

I have a script that uses sh shell. I get an error in the line that uses the source command. It seems source is not included in my sh shell.

如果我明确尝试从 shell 运行 source 我得到:

If I explicitly try to run source from shell I get:

sh: 1: source: not found

我应该以某种方式安装源代码"吗?我的 sh 版本有误吗?

Should I somehow install "source"? Do I have a wrong version of sh?

推荐答案

/bin/sh 通常是其他一些试图模仿 The Shell 的 shell.许多发行版使用 /bin/bash 作为 sh,它支持 source.但是,在 Ubuntu 上,使用了不支持 source/bin/dash.大多数 shell 使用 . 而不是 source.如果您无法编辑脚本,请尝试更改运行它的 shell.

/bin/sh is usually some other shell trying to mimic The Shell. Many distributions use /bin/bash for sh, it supports source. On Ubuntu, though, /bin/dash is used which does not support source. Most shells use . instead of source. If you cannot edit the script, try to change the shell which runs it.

这篇关于在 sh shell 中找不到 source 命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆