I have the following functions.
hello () {
echo "Hello"
}
func () {
hello
echo "world"
}
If I don't want the output of the hello function to be printed but want to do something with it, I want to capture the output in some variable, Is the only possible way is to fork a subshell like below? Is it not an unnecessary creation of a new child process? Can this be optimized?
func () {
local Var=$(hello)
echo "${Var/e/E} world"
}