Gradle 'exit' in a shell script

女生的网名这么多〃 提交于 2020-01-03 19:17:19

问题


I want to build a package by Gradle (3.2.1) using a script.

The script (hoge.sh) is

#!/bin/sh
gradle build
echo "hello"

./hoge.sh works and prints "hello".

However, cat hoge.sh | /bin/sh -s stops at gradle build. The build looks successful but the process never prints "hello".

How can I fix hoge.sh to run by cat hoge.sh | /bin/sh -s correctly??

If I run cat hoge.sh | /bin/sh -i, it returns,

sh-4.2$ #!/bin/sh
sh-4.2$ gradle build
###gradle information###
sh-4.2$ exit

For information, using Gradle 2.1, the exit comes at last (after echo "hello").

sh-4.2$ #!/bin/sh
sh-4.2$ gradle build
###gradle information###
sh-4.2$ echo "hello"
hello
sh-4.2$ exit

How can I avoid the exit by Gradle and let echo "hello" survive?
add something to the second line gradle build ? or to cat hoge.sh | /bin/sh?

来源:https://stackoverflow.com/questions/40972099/gradle-exit-in-a-shell-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!