I am writing a script that stores some of the command line arguments as an array, and uses the array later, but I'm having an issues getting the correct length of the array in the script.In the terminal, using bash, I tried this:$:>array=( 1 2 3 4 )$:>echo array = ${array[*]} and length = ${#array[*]}and the output from echo is:array = 1 2 3 4 and length = 4Which is working correctly. I simplified the script that I was having an issue with, and the script is supposed to do the exact same thing, but I get an array length of 1. The script is as follows..#!/bin/bashlist=${@}echo array = ${list[*]} and length = ${#list[*]}And if I call the script from the terminal with$:>./script.sh ${test[*]}the output isarray = 1 2 3 4 and length = 1I've tried a few different way of saving the array, and printing it out, but I can't figure out how to fix this issue. Any solutions would be appreciated!
Issue with array length in bash script
bash;array