Ubuntu 尝试在.bashrc中添加命令时未找到命令消息

Ubuntu 尝试在.bashrc中添加命令时未找到命令消息,ubuntu,.bash-profile,Ubuntu,.bash Profile,我问了一个问题 当我尝试这个建议时,我得到了以下错误信息 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 ver

我问了一个问题

当我尝试这个建议时,我得到了以下错误信息

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
编辑:

新的

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

go_app: command not found

您是否尝试过将
导出LC\u CTYPE=“utf-8”
更改为
导出LC\u CTYPE=“en\u US.utf8”
?后者在我的系统上引用了一个有效的区域名称。您可以通过运行
locale-a

在系统上查看有效的区域设置名称。这应该可以解决“对不起,找不到的命令已崩溃!”问题:


如果上述任何解决方案都不起作用,则表示“未找到命令”实用程序本身配置错误

只需删除该实用程序

sudo apt purge command-not-found
再安装一次,

sudo apt install command-not-found

错误的WSL升级弄乱了我的一些文件权限。以上这些对我都不起作用,但这确实起了作用:

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

最好最后加一个星号:

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

为什么在
.bashrc
中有
source.bashrc
?这不是递归加载本身吗?这是我最初的问题中有人推荐的修复方法。我现在已经把它移走了。并将导出LC_CTYPE=“utf-8”更改为导出LC_CTYPE=“en_US.utf8”现在获取的只是
go\u app:command未找到
,后者是否解决了问题,如果你打开了一个新的终端?那么原来的问题就解决了。我猜你把
source.bashrc
放错了文件。仍然得到命令not found语句。查看我更新的问题我猜你把
source.bashrc
放错文件了。正如我所说的,用.bashrc来源代码是没有意义的。试着把它放在正确的文件中。你可以在我的问题中看到我的/var/www目录。我应该把source.bashrc放进哪个文件?我不知道,因为我不是叫你放进去的那个人!也许问问那个家伙!对它将root-only访问权扩展到对我有效的用户读取访问权,但在安装之后,还需要
sudo-rm-rf/var/lib/command-not-found
sudo-apt-update
sudo chmod o+r /var/lib/command-not-found/commands.db*
>----------------------------------------------------^