I need write a Korn shell which accept input parameter. But this input paramter must match one of the string in an existsing file (listkeyword). Can someone one help, how this can be done ?
What do you have so far?
Perhaps something like this:
#!/usr/bin/env ksh
read SOMEINPUT?"Enter your input: "
FILE="/tmp/somefile"
if [[ $(grep -i -c $SOMEINPUT $FILE) -ge 1 ]]; then
echo "$SOMEINPUT exists in $FILE."
else
echo "No match found for $SOMEINPUT in $FILE."
fi
Might be worth storing the list in a variable and running a select loop on it