function get_arguments()
{
read -p 'data : ' data
read -p 'lambda: ' lambda
echo $data $lambda
}
data,lambda=$(get_arguments)
But i am getting an error
data : /home/wolfman/Downloads/data
lambda value: 2
./shell_script.sh: line 25: data,lambda,= /home/wolfman/Downloads/data: No such file or directory
But
1) Why is it even evaluating that whether that file exists or not.. its just a string??
2) what am i doing wrong 🙁
THanks
shsyntax does not allow that. But, the variables in the function are global, so you can just invoke the function anddataandlambdawill be set in the caller.functions return an integer value, but they can print arbitrary data which can be read by the caller. For example, you could do:
The drawback is that the values are only available in that block. (The pipe creates a subshell, and the values read by
readare only valid in that subshell.)