This is my bash script. I want to pass a command as an argument and run it.
- case 1) is not working
- case 2) is working well.
How can I make case 1) work?
function menu(){
echo "[$@]"
declare -a myarray
while IFS= read -r input; do
result_array+=( "$input" )
((count++))
printf "[$count] %s\n" "${input[0]}"
done < <( $@ ) ########### case1) I want to use but it is not working.
## done < <( "find . -name '*.bak'" ) ########## case2) working well
}
## main
menu "find . -name '*.bak'"
I tried every shell variable expansion I know but it ended up failure.