我如何暂停或将答案传递给 Jenkins 执行 shell 脚本

How do I either pause, or pass answers to Jenkins execute shell script

这也是一个bash问题。我有一个脚本,当 运行 ./recompile 它分别问 3 个问题,一次 1 个。

答案如下:1,1,y.

所以我需要 jenkins 运行 我的脚本,但也要回答问题。

Jenkins 有这个执行 shell 框,我认为它基本上是一个 bash 脚本入口点。

所以我已经设置它来执行我的脚本,但我不知道如何模拟答案。

我做了这样的事情

./recompile
1
1
y

./recompile && 1 && 1 && y

但是它说 1 不是命令....

我在寻找什么 bash 命令来传递脚本后将被询问的参数 运行?

编辑

当脚本是 运行 时,它应该像这样开始。

    $ ./recompile

Choose the environment to recompile:  1) Dev  2) Stage  3) Prod ? 1
Use Watch mode?y
Will WATCH after dump completed. Use ctrl+c to exit

You are about to recompile Symfony DEV Environment, please verify the following settings:
------------------------------------------
- DEV
- clear cache
- install assets as symlinks
- watch assets, includes force dumping (use ctrl+c to exit)
Ready to run? y

---------------------------
running 

您需要redirect STDIN进入您的脚本

$ echo "a
> b
> c" | sh a.sh
a
b
c
a  b  c

使用这种 bash 脚本 a.sh

#!/bin/bash

echo "a"
read $a

echo "b"
read $b

echo "c"
read  $c

echo "a ${a} b ${b} c ${c}"