bash - 是否有与“-y”等效的标志用于在 bash 中选择选项?
问题描述
我正在启动要Rust
在我的 macOS 上安装的脚本。命令行如下:
curl https://sh.rustup.rs -sSf | sh
我得到的是(我裁剪它):
Welcome to Rust!
This will download and install the official compiler for the Rust programming
language, and its package manager, Cargo.
Current installation options:
default host triple: x86_64-apple-darwin
default toolchain: stable
modify PATH variable: yes
1) Proceed with installation (default)
2) Customize installation
3) Cancel installation
>
我必须在 1、2 和 3 之间选择一个选项。但我想在命令行中添加一个标志以始终选择一个选项,比如 2。
我正在考虑类似的东西:
curl https://sh.rustup.rs -sSf | sh -2
-y
与对所有问题强制“是”相同。但这些都不起作用。
有没有办法这样做bash
?
解决方案
推荐阅读
- java - 如何在Java中打印矩阵的所有对角线
- javascript - 在写入 document.cookie 时无法访问死对象?
- postgresql - 从 Google Data Studio 连接到 Heroku Postgres 时出现 SSL 证书错误
- android - M1 mac 上的 android studio 和 manager 错误(未安装模拟器)
- flutter - 如何修复 Flutter build_runner 错误:无法预编译 build_runner:build_runner:
- java - onClickListener 在 Recycler Adapter 类中不起作用
- macos - 如何将“/System/Library/PreferencePanes/Trackpad.prefPane/Contents/MacOS/Trackpad”变成人类可读的?
- css - 百分比在线性渐变中代表什么:CSS?
- python - 如何在 pandas 中使用来自数据框的值作为列名,并将列名作为值插入数据框
- android - 为什么我的 TypeConverter 没有被调用/使用。程序似乎无法识别它