#! /bin/bash
dir=$(find . -type f)
echo ${dir[0]}
echo "This is dir[0]"
echo ${dir[1]}
I want to add all the files recursively in the current dir into an array arr[], but above code fails,
zhangyf@zhangyf-desktop:~/test/avatar$ ./new.sh
./daily_burn.sh ./test.sh ./.gitignore ./new.sh
This is dir[0]
dir is not an array in this code. What is the correct way ? Thanks !
1 Answer