How to disallow user input ” * ”
read -p "inputData : " inputData
#user input *
echo $inputData
#here it outputs the current files in the directory... how do we prevent this?
what kind of regular expressions should i check for user input?
here is what i got so far…
count=`echo "$1" | grep -q "[\*\.\+\?]" `
Quote your variable to prevent pathname expansion
Example
Alternatively, you can turn off globbing by first running
set -fin your scriptIf you do either of these, you don’t need to check for any nasties in the input as long as you’re not running it through
eval