I am very new to shell. I need to return multiple values from a shell function that's why I am sending the arguments as parameters to the function like we do in programming languages like C using pointers. I am calling the function like this
splitDate $date day month year
here day month & years are the variable in which I want to store the values. My function definition looks like this
splitDate(){
export IFS="/"
declare -a var
index=0
for word in $1; do
var[ $index ]=$word
((index++))
done
$2=${var[0]}
$3=${var[1]}
}
When I run this I get this error "day=theValueIWant: command not found" &"month=theValueIWant: command not found" Whats wrong here? test case : If i provide 04/05/2017 as date I expect day to store 04, month to store 05 & year to store 2017