bash_completion 不起作用,未找到源命令

发布于 2024-08-24 23:18:00 字数 295 浏览 3 评论 0原文

我最近继承了一个 Ubuntu Hardy 盒子,它的开箱即用功能相当时髦。我尝试做的第一件事是编辑我的 .bashrc 配置文件以进行一些着色并添加一些我通常拥有的别名,但是当我尝试获取 ~/.bashrc 时,我得到 sh: source: not found 而且我还注意到选项卡式自动完成功能也根本不起作用 - 我相信这称为 bash_completetion,但我相信你可以告诉我,我不是专家。

我是否应该编辑任何特定文件才能获得我习惯的开箱即用的基本功能?未安装 source 命令不是很不寻常吗?

I recently inherited a Ubuntu Hardy box that acts rather funky out-of-the-box. The first things I tried to do was edit my .bashrc profile to do some coloring and add some aliases I usually have, but then when I try to source the ~/.bashrc I get sh: source: not found and I have also noticed tabbed autocomplete is also not working at all - I believe this is called bash_completetion, but as I'm sure you can tell, I'm not an expert.

Are there any specific files I should be editing to get this basic functionality I am accustomed to out-of-the-box? and isn't it unusual for the source command to not be installed?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

云归处 2024-08-31 23:18:00

一般思考过程:

  • 使用 ps 确认您实际上使用的是 sh 而不是 bash

  • 确认 /bin/bash 存在并正常工作(并且 [如果没有,请重新安装)

  • 使用 chsh 将您的登录 shell 更改为 bash

  • 安装 bash-completion 包(如果缺少)

General thought process:

  • Use ps to confirm you're actually using sh not bash

  • confirm that /bin/bash exists and works properly (and [re]install it if it doesn't)

  • use chsh to change your login shell to bash

  • install the bash-completion package if it's missing

御弟哥哥 2024-08-31 23:18:00

您应该得到 bash: source: command not find (当然,bash 永远不会找不到 source)。如果您得到 sh:,那么您要么根本没有运行 bash,要么运行带有告诉它假装是 Bourne shell /bin/sh 的标志的 bash 。输入 bash 来获得真正的 bash,或者编辑启动配置,这样它就不会为您传递该标志(不确定它们在 Ubuntu 中的位置)。

You should be getting bash: source: command not found (except that bash will never fail to find source, of course). If you get sh:, then you're either not running bash at all, or running bash with the flag that tells it to pretend it's the Bourne shell /bin/sh. Type bash to get a real bash, or edit the startup configuration so that it doesn't pass that flag for you (not sure where they are in Ubuntu).

千と千尋 2024-08-31 23:18:00

Ubuntu 服务器有时将 /bin/sh 作为默认 shell。这与您发布的问题一致,因为 /bin/sh 没有可用的 source 命令。如果您发现缺少 bash 功能,则可能您没有使用 bash。以下是要遵循的步骤,以及每次登录新的 *nix 盒子时要记住的一些内容:

  1. 使用 echo $0 检查您正在使用的 shell
  2. 查看 cat /etc 可以使用哪些 shell /贝壳
    1. 如果您想使用 bash,请在列表中查找 /bin/bash
    2. 如果 bash 不在列表中,apt-get install bash(特定于 Ubuntu/Debian)
  3. 通过 exec /bin/bash 开始使用 bash 使用
  4. chsh -s /bin/bash 将 bash 设置为登录 shell

Ubuntu servers sometimes have /bin/sh as the default shell. This is consistent with the issue you posted, as /bin/sh does not have the source command available. If you are noticing missing bash features, it might be possible that you aren't in bash. Here are the steps to follow, and something to remember whenever you log on to a new *nix box:

  1. Check which shell you are using with echo $0
  2. See what shells are available with cat /etc/shells
    1. Look for /bin/bash in the list if you want to use bash
    2. If bash is not in the list, apt-get install bash (Ubuntu/Debian specific)
  3. Start using bash with exec /bin/bash
  4. Set bash as your login shell with chsh -s /bin/bash
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文