I am trying to write bash-script with user input. Script gets user input and build find command with data from input(Use parameter if they aren't empty). I was reading about bash expansion from here and i did something like :
eval find $USERPATH "${USERNAME:+'-name' \"\$USERNAME\"}" "${USERSIZE:+'-size' \"\$USERSIZE\"}" "${USERDATA:+'-mmin' \"\$USERDATA\"}"
It's work great, but i want to search by content, so i need add
-exec fgrep -l $USERCONTENT {} \;;
but i can't. I was trying something like this
"${USERCONTENT:+'-exec fgrep -l' \"\$USERCONTENT {}\;;'\"}"
but it doesn't work. I don't know how i can do this in good way.