bash:如果未安装,则自动安装包

时间:2013-12-27 16:36:02

标签: linux bash ubuntu package apt-get

假设我认为我安装了SVN。我运行命令,得到以下输出:

aoneill@aoneill-Laptop:~/Documents$ svn
The program 'svn' is currently not installed. You can install it by typing:
sudo apt-get install subversion

我的问题是:我可以更改输出,或者发现这样的情况,说出类似下面的内容,并在最后提示?

aoneill@aoneill-Laptop:~/Documents$ svn
The program 'svn' is currently not installed. You can install it by typing:
sudo apt-get install subversion

Install the package? [y/n]

谢谢!它会使包装处理更好!

1 个答案:

答案 0 :(得分:5)

Exactly what you are looking for

export COMMAND_NOT_FOUND_INSTALL_PROMPT=1