Linux bash: Multiple variable assignment
First thing that comes into my mind: read -r a b c <<<$(echo 1 2 3) ; echo “$a|$b|$c” output is, unsurprisingly 1|2|3
First thing that comes into my mind: read -r a b c <<<$(echo 1 2 3) ; echo “$a|$b|$c” output is, unsurprisingly 1|2|3
No, but you could return an array containing your values: function getValues() { return [getFirstValue(), getSecondValue()]; } Then you can access them like so: var values = getValues(); var first = values[0]; var second = values[1]; With the latest ECMAScript 6 syntax*, you can also destructure the return value more intuitively: const [first, second] = … Read more