filter_option=" -name "*" " file_paths=$(find "." -type f $filter_option) echo find "." -type f $filter_option echo $file_paths
samuel@:~/…/linux$ ./test.sh
find . -type f -name “*”samuel@:~/…/linux$
How do I fix this to get find . -type f -name "*"
‘s result?
Advertisement
Answer
I suggest to use an array:
filter_option=(-name '*') file_paths=$(find "." -type f "${filter_option[@]}")