问题
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