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

How to return a string value from a Bash function

$
0
0

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

I'll write the example in java to show what I'd like to do:

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

The example below works in bash, but is there a better way to do this?

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

Viewing all articles
Browse latest Browse all 207

Trending Articles



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