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

How to return a string value from a Bash function

$
0
0

I'd like to return a string from a Bash function.

Java example:

public String getSomeString() {  return "tadaa";}String variable = getSomeString();

This bash example works, but are there better ways?

function getSomeString {   echo "tadaa"}VARIABLE=$(getSomeString)

Viewing all articles
Browse latest Browse all 228

Trending Articles



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