Linux
sh + how to send cntrl c 然後輸入 yes 接受許可
我需要輸入 CNTRL C 然後我需要輸入
yes
,才能接受許可證現在我正在考慮如何自動化這個過程
我們可以通過執行 sh 腳本並輸入
CNTRL C
然後輸入 yes 來自動化這個過程嗎?sh CentOS-7.0.1406.libcurl.20180621.x86_64.sh LICENSE AGREEMENT FOR ZVELODB SDK LIBRARIES IMPORTANT, READ CAREFULLY: THIS ZVELODB SDK LIBRARIES LICENSE AGREEMENT ("LICENSE AGREEMENT") IS A LEGAL AGREEMENT BETWEEN YOU (EITHER AN INDIVIDUAL OR A SINGLE ENTITY, IDENTIFIED HEREIN AS "YOU" OR "YOUR") AND ZVELO, INC. ("ZVELO") FOR THE ZVELODB SDK LIBRARIES ("ZVELODB") AND OTHER PROPRIETARY SOFTWARE REQUIRED FOR THE PROPER INTEGRATION OF ZVELODB ("ZVELODB SOFTWARE"). ZVELO IS WILLING TO GRANT YOU THE FOLLOWING LIMITED, NON-EXCLUSIVE, NON-ASSIGNABLE, REVOCABLE LICENSE TO USE THE ZVELODB SOFTWARE ACCORDING TO THIS AGREEMENT ONLY ON THE CONDITION THAT YOU ACCEPT ALL TERMS IN THIS AGREEMENT. BY INSTALLING OR USING ZVELO SOFTWARE YOU ACKNOWLEDGE THAT YOU HAVE READ THIS LICENSE AGREEMENT AND THAT YOU AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE AGREEMENT. IF YOU DO NOT AGREE TO THE TERMS OF THIS LICENSE AGREEMENT, ZVELO IS NOT WILLING TO LICENSE THE ZVELODB SOFTWARE TO YOU AND YOU ARE NOT AUTHORIZED TO USE THE ZVELODB SOFTWARE. The zveloDB Software is protected by copyright laws and international copyright treaties, as well as other intellectual property laws and treaties. Unauthorized reproduction or distribution is subject to civil and criminal penalties. 1. GRANT OF LICENSE. zvelo grants You the right to use the zveloDB Software only in conjunction with the validly signed Non-Disclosure Agreement (NDA) between zvelo and You. 2. RESTRICTIONS. You may not use, copy, modify, or transfer the zveloDB Software, or any copy thereof, in whole or in part, except as expressly provided in this License Agreement or as defined under a separate zvelo License Agreement. You may not reverse engineer, disassemble, decompile, or translate the zveloDB Software, or otherwise attempt to derive the source code, algorithms, or data files of the zveloDB Software, or authorize any third party to do any of the foregoing. You may not use data returned ("RESULTS" or "CATEGORIZATIONS" or "META-DATA") from zveloDB Software to extend or enhance other software or products, unless otherwise agreed to in writing by an authorized representative of zvelo. You may not use the zveloDB Software for any software development, application deployment and/or ultimate production purpose. Except as expressly permitted in the previous two sentences, any attempt to transfer any of the rights, duties or obligations hereunder is void. You may not rent, lease, loan, resell for profit, or distribute the zveloDB Software, its results, or any part thereof except as expressly provided in this License Agreement or as defined under a separate zvelo License Agreement. You agree to comply with all applicable laws regarding the use of the zveloDB Software. 3. YOUR RESTRICTIONS. You agree: 3.1. to make all payments due to zvelo in a timely fashion; 3.2. to notify zvelo promptly by email at servicedelivery@zvelo.com if You suspect unauthorized use of the zveloDB Software and that You remain responsible for such unauthorized use; 3.3. not to resell, assign, transfer, or delegate this License Agreement or Your rights or obligations under it without the prior written consent of zvelo and that any attempt to do such an assignment without prior written consent is void; 3.4. not to alter the controls of a hard drive or computer system to enable the use of the zveloDB Software after termination of the license; 3.5. that You are responsible for the value obtained from Your use of the zveloDB Software; 3.6. that You will implement or install the zveloDB Software only in an operating system environment and upon such equipment as approved by zvelo; 3.7. that You are not a specifically designated individual or entity under any U.S. (or other) embargo or otherwise the subject, either directly or indirectly, to any order issued by any agency of the U.S. Government (or any other government) limiting, barring, revoking or denying, in whole or in part, Your export privileges and that You will notify Us immediately in the event You become subject to any such order; 4. RENEWAL AND TERMINATION. 4.1. Without prejudice to any other rights, this License Agreement will terminate immediately without notice if you fail to comply with the terms and conditions of this License Agreement. Upon notice of termination, you agree to immediately cease all use of the zveloDB Software and destroy all copies of the zveloDB Software and its results. 5. OWNERSHIP. . . . 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Do you agree with the License? [yes/no]
到目前為止我所做的是:
sh CentOS-7.0.1406.libcurl.20180621.x86_64.sh < < trap ctrl_c INT >/dev/null < <(echo y)
但這種方法不起作用
Perl/python 單線也是預期的
預期結果範例:
Do you agree with the License? [yes/no] yes Extracting . . . lib-4.0.20-20180619.x86_64.rpm lib-devel-4.0.20-20180619.x86_64.rpm Extract completed. Continue installation by installing the RPM
重要的提示
我能說的是,當我執行腳本並執行 CNTRL C 時,我馬上就會得到關於是的問題
您可能應該將
expect
其用於此類任務。但是,作為一個快速而骯髒的組合,你可以
script(1)
用作一個小期望:{ sleep .3; printf '\003'; sleep .3; printf 'y\r'; ...other prompt responses...; } | script -q /dev/null -c 'sh that_installer.sh'
\003
是 Control-C,\r
是 Return/Control-M,等等。