I know I can pass arguments to a bash function like
function output () {
echo 'text' > text.txt;
echo $1 >> text.txt;
echo 'more text' >> text.txt;
}
output something;
But I actually need to pass the output of another script or program and have it in one variable, so I am able to call the function like
output $(ls);
... and have the output of ls in one single variable in the function. Is that possible? How?
Or can I at least echo every single input to the function?