小编use*_*013的帖子

如何使用bash将输入从一个脚本传递到另一个脚本

我正在编写一个脚本,我想在其中启动 mysql_secure_installation脚本并在每个提示处提供适当的答案。我尝试使用这样的回声:

echo -e "\n\n$db_pass\n$db_pass\n\n\n\n\n" | /usr/bin/mysql_secure_installation
Run Code Online (Sandbox Code Playgroud)

它不完全起作用。它似乎正确回答了最后 5 个问题,但没有正确回答前 3 个问题(这是在一个CentOS 6.5盒子上)。这是输出:

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

stty: standard input: Invalid argument
Enter current password for root (enter for none):
stty: standard input: Invalid argument
OK, successfully used …
Run Code Online (Sandbox Code Playgroud)

mysql bash centos6

7
推荐指数
2
解决办法
5897
查看次数

标签 统计

bash ×1

centos6 ×1

mysql ×1