I want to store the each output of ls command in the variable array.
I have already tried at arbitrary directory: var=$(ls);echo $var
It is storing the whole file names under the directory to the variable.
I also tried other methods but it is storing each word as variable element in the array.
Is there any method to store the name of each file in a directory at different indexes of an array?