linux運行不存在的命令報錯

在Linux中運行一個命令嘗試是否存在,突然報錯了

Could not find the database of available applications, run update-command-not-found as root to fix this
Sorry, command-not-found has crashed! Please file a bug report at:
http://www.debian.org/Bugs/Reporting
Please include the following information with the report:

command-not-found version: 0.3
Python version: 3.7.3 candidate 1
Distributor ID: Kali
Description: Kali GNU/Linux Rolling
Release: 2019.2
Codename: n/a
Exception information:

local variable ‘cnf’ referenced before assignment
Traceback (most recent call last):
File “/usr/share/command-not-found/CommandNotFound/util.py”, line 23, in crash_guard
callback()
File “/usr/lib/command-not-found”, line 93, in main
if not cnf.advise(args[0], options.ignore_installed) and not options.no_failure_msg:
UnboundLocalError: local variable ‘cnf’ referenced before assignment

根據報錯提示需要以root用戶運行update-commond-not-found

結果又報錯了

根據報錯提示執行編輯報錯文件

打開報錯文件找到如圖

如有同樣報錯,繼續編輯報錯文件,添加所報錯的缺失項

最後執行自己的測試命令,就不存在錯誤了

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章