ubuntu - 当我尝试在 .bashrc 中添加命令时找不到命令消息

标签 ubuntu bash

我在 how to write a beautifully elegant linux command in bash shell 问了一个问题

当我尝试这个建议时,我收到了以下错误消息。

Sorry, command-not-found has crashed! Please file a bug report at:
https://bugs.launchpad.net/command-not-found/+filebug
Please include the following information with the report:

command-not-found version: 0.3
Python version: 3.2.3 final 0
Distributor ID: Ubuntu
Description:    Ubuntu 12.10
Release:    12.10
Codename:   quantal
Exception information:

unsupported locale setting
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/CommandNotFound/util.py", line 24, in crash_guard
    callback()
  File "/usr/lib/command-not-found", line 69, in main
    enable_i18n()
  File "/usr/lib/command-not-found", line 40, in enable_i18n
    locale.setlocale(locale.LC_ALL, '')
  File "/usr/lib/python3.2/locale.py", line 541, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

这是我目前在我的 .bashrc 中写的内容

source .bashrc
export LC_CTYPE="utf-8"
function go_app() { cd /var/virtual/$1/; }

这是我的/var/www 目录

www-data@ubuntu:~$ ls -la
total 52
drwxr-xr-x  5 www-data www-data  4096 Nov  9 15:03 .
drwxr-xr-x 15 root     root      4096 Nov  8 09:51 ..
-rw-------  1 www-data www-data 19657 Nov  7 23:24 .bash_history
-rwxr-xr-x  1 www-data www-data    82 Nov  9 15:03 .bashrc
drwx------  2 www-data www-data  4096 Aug  7 19:28 .cache
drwxrwxr-x  3 www-data www-data  4096 Aug  9 19:19 .composer
-rw-------  1 www-data www-data     6 Aug  8 11:48 .mysql_history
-rw-------  1 root     root        50 Nov  9 15:08 .nano_history
drwxrwxr-x  2 www-data www-data  4096 Aug  7 20:19 .ssh

编辑:

新的.bashrc

export LC_CTYPE="en_US.utf8"
function go_app() { cd /var/virtual/$1/; }

错误信息:

go_app: command not found

最佳答案

糟糕的 WSL 升级搞砸了我的一些文件权限。其他答案都不适合我,但这确实有效:

sudo chmod o+r /var/lib/command-not-found/commands.db

关于ubuntu - 当我尝试在 .bashrc 中添加命令时找不到命令消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19873430/

相关文章:

ubuntu - 如何授予makefile复制文件夹的权限?

bash - 使用 Bash 逐行读取并保留空间

macos - .bash_profile 中 `$PATH` 导出的末尾或开头的 `PATH`(对于 Mac 上的 Git)

bash - 无法使用cat和<< EOF通过SSH远程创建文件

ubuntu - 使用 ros2 主题列表时可以看到主题,但无法通过网络回显?

git - jekyll GitHub元数据错误

c++ - 如何修复重叠的 XML?

bash - 引用名称包含点的 bash 变量

ubuntu - 将 optirun 和 g++ 设置为编译器以在 Ubuntu 中编译 OpenCL

ubuntu - (双启动)Windows 启动和更新后 Ubuntu 18.04 没有声音