I want to get all changed files from
$git diff --name-only SHA1 SHA2
and save them to an array variable in bash, but when I use:
files=$(git diff --name-only SHA1 SHA2)
for some reason it saves all file names as a string with space delimiter, so when I type
$echo ${files[0]}
I get all file names as a single String, and
$echo ${files[1]}
is empty. So how do I save each file name as an array element, so that I could iterate over them?