Quantcast
Channel: Active questions tagged return-value - Stack Overflow
Viewing all articles
Browse latest Browse all 209

What's does a bash function return when there is no “return” statement?

$
0
0

Is the return value of a bash function the status of the last executed command?

I wrote this test and it looks like it's so. I just want to verify. No one has asked this question before apparently and tutorials don't mention this.

Test program:

funa() {  echo "in funa";  true;};funb() {  echo "in funb"  false;};funa && echo "funa is true";    funb && echo "funb is true";

Output when I run the program:

in funafuna is truein funb

Does anyone know the answer?


Viewing all articles
Browse latest Browse all 209

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>