I am very new to bash programming and wanted to create a script that would store each result of find individually into an array. Now I want the command variable to expand on the statement MYRA=($(${Command} $1))
Command = 'find . -iname "*.cpp" -o -iname "*.h"'
declare -a MYRA
MYRA=($(${Command} $1))
echo ${#MYRA[@]}
However when I try this script I get the result
$ sh script.sh
script.sh: line 1: Command: command not found
0
Any suggestions on how I can fix this ?
array=( $(find ...) )fails miserably with filenames that contain whitespace, glob characters, or are in any other way interesting.