我的 shell 脚本中有以下命令。
ionic cordova platform add browser
这提示我输入“Y”,如下所示:
? Are you sure you want to continue? (Y/n)
我希望使它成为非交互式的,因此我尝试Yes
使用以下方法通过:
echo Y | ionic cordova platform add browser
Yes | ionic cordova platform add browser
ionic cordova platform add browser << 'Y'
与上述; 该命令执行非交互式但接受No
而不是Yes
如下所示:
[WARN] About to add the browser platform to your app.
The browser Cordova platform is not recommended for production use.
Instead, we recommend using platform detection and browser APIs to target web/PWA. See the Cross Platform docs[1]
for details.
Alternatively, ⚡️ Capacitor ⚡️ (https://ion.link/capacitor), Ionic's official native runtime, fully supports
traditional web and Progressive Web Apps. See the Capacitor docs[2] to learn how easy it is to migrate.
[1]: https://ion.link/cross-platform-docs
[2]: https://ion.link/capacitor-cordova-migration-docs
--no-confirm: Are you sure you want to continue? No
您能否建议如何自动输入Yes
并使命令非交互?