I have a small problem in here with bash
I wrote an array in a simple function and I need to return it as an array with read command and also need to call it somehow.
function myData {
echo 'Enter the serial number of your items : '
read -a sn
return ${sn[@]}
}
for example like this ???
$ ./myapp.sh
Enter the serial number of your items : 92467 90218 94320 94382
myData
echo ${?[@]}
Why we don't have return value in here like other languages ? thanks for your help...
returnin Bash – it's meant to convey exit status, not to return data from a function.myfunc() { echo got input as $@ ; } ; var=$(myfunc some text); echo "$var". Good luck.myDatagoing to use the input (92467 ...), orreadfrom stdin ?