Posts Tagged ‘ bash ’

Returning values from shell functions, and the non-exit thereof.

August 25, 2008
By gary

So, I wanted to write a (bash) shell function that returned a value to the calling routine, rather than set a global variable. I found that the following would do what I wanted #!/bin/bash func() { echo "This is the return value:" return }   x=$(func "param") echo "The return value is : $x" And this is what we see lovebox:tmp gjl$...
Read more »

Tags:
Posted in Scripts | No Comments »