我正在考虑这个输出的用例:
The program 'tiger' is currently not installed. You can install it by typing:
sudo apt-get install tiger
我怎样才能让它提示我安装该软件包?例如,它会输出以下内容:
The program 'tiger' is currently not installed. You can install it by typing:
sudo apt-get install tiger
# Confirmation can go here
[sudo] password for tim:
The following NEW packages will be installed
tiger tripwire
0 to upgrade, 11 to newly install, 0 to remove and 0 not to upgrade.
Need to get 8,416 kB of archives.
After this operation, 26.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] # and/or confirmation can go here
我不想自己运行它。我怎样才能让它自动运行呢?并给我不安装的选项?
答案1
如果您设置环境变量 COMMAND_NOT_FOUND_INSTALL_PROMPT
喜欢1
export COMMAND_NOT_FOUND_INSTALL_PROMPT=1
系统将询问您是否要安装该包:
me@myhost:~$ tiger
The program 'tiger' is currently not installed. You can install it by typing:
sudo apt-get install tiger
Do you want to install it? (N/y)
如果你回答y
它就会运行
sudo apt-get install tiger
看如何设置环境变量?如何设置环境变量。