0

所以通常在bash中,我会手动点击返回

[archlinux-64 ~]$ sudo pacman -S base-devel
pacman: /usr/lib/libcurl.so.4: no version information available (required by /usr/lib/libalpm.so.7)
:: There are 12 members in group base-devel:
:: Repository core
   1) autoconf  2) automake  3) binutils  4) bison  5) fakeroot  6) flex  7) gcc  8) libtool
   9) m4  10) make  11) patch  12) pkg-config

Enter a selection (default=all):

然后在标准输出的下一个提示中键入 Y 并按回车键:

warning: make-3.82-4 is up to date -- reinstalling
resolving dependencies...
looking for inter-conflicts...

Targets (14): gcc-libs-4.7.0-4  libltdl-2.4.2-5  autoconf-2.68-2  automake-1.11.4-1
              binutils-2.22-5  bison-2.5-3  fakeroot-1.18.2-1  flex-2.5.35-5  gcc-4.7.0-4
              libtool-2.4.2-5  m4-1.4.16-2  make-3.82-4  patch-2.6.1-3  pkg-config-0.26-2

Total Download Size:    24.91 MiB
Total Installed Size:   104.95 MiB
Net Upgrade Size:       8.44 MiB

Proceed with installation? [Y/n] 

但是在完成了这个 arch linux base-devel 安装几次之后,我想直截了当,并在一行 bash 命令中使用 default 和 Y 执行以下所有操作。

我如何在一行中编写这个 bash 命令?

4

2 回答 2

1

您可以通过传递 --noconfirm 选项来做到这一点:

pacman -S --noconfirm base-devel

如果您想摆脱下载进度条等,您也可以将其关闭:

pacman -S --quiet --noprogressbar --noconfirm base-devel

查看手册页:http ://www.archlinux.org/pacman/pacman.8.html

于 2012-04-12T08:39:41.683 回答
0

检查“是”命令。尝试使用类似的东西:

yes 'y' | my_script
于 2012-04-12T08:39:14.447 回答