I'm trying to write a bash script that will ask echo "What programme do you want to see?" and then give the answer as 'foo', so that 'foo' can be read by the line which says apt-cache show foo|grep -i description -A 8.

But how to do it, please?

I've got the echo line as above, but haven't a clue as to what to do from there. This is to be used on Debian.

| improve this question | | | | |

It's not too hard.

echo "What program do you want to see?"
read program
apt-cache show "$program" | grep -i description -A 8

See: Catching user input. In general, if you're new to Bash scripting, try to read a few guides first. Many of the basics (assigning variables, getting user input, output, variable substition) are covered very well in the Bash Beginners Guide.

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.