I am trying to get bash to ask for a user input from read and to check against a file or list of files, then respond with the result from that chesk. This is as far as I have gotten as of yet...
read -p "what are we looking for?" RESP
if [ "$RESP" = sed -n ${some line from inside file} ./file |
then do "returned variable from file"
else
echo "You need more bash programming"
I know I am very new here but I cant figure it out, what ever the response is needs to be check against a file (what inside the file)- line by line then return an associated variable of that line
say like
"RESP"=line 3(or any line that matches) of ./this_file
return "var1" of that line
Do "var1"
fi
Is this the way to do this what would this code look like in simple bash I am so lost please help
example:
line1:"please open google" "var1[open http:www.google.com]
pass "var1" to bash
./this_filethe same as./file? How is avar1associated with a line? It would help if you provided specific examples to show what it is that you really want.