#!/bin/bash
# Output from a local function can be captured in a variable
function example
{
param=$1
echo "param = $1"
}
arg="test"
var=$(example $arg)
echo $var # will output "param = test"
#!/bin/bash
# Output from a local function can be captured in a variable
function example
{
param=$1
echo "param = $1"
}
arg="test"
var=$(example $arg)
echo $var # will output "param = test"