update repository
[cmdllinux.git] / bash_n_examples / bash / 01comm / _find_arr1.sh
blobab3d12d4c4642a6abf0c39aaefae6a43d736f5db
1 declare -a arr
2 num=0
3 IFS=$'\n'
4 find -type f | while read file; do
5 FILE=${file##*/}
6 DIR=${file%/*}
7 num=0
8 unset arr
10 while read line; do
11 arr[num]="$line"
12 (( num++ ))
13 done < <(find -path "$DIR" -prune -o -type f -name "$FILE" -print)
15 if [[ ! -z "$arr" ]]; then
16 echo "$file"
17 echo "${arr[*]/#/->}"
19 done