How to analyse results of grep

Hi all,

I'm working with a peice of software that runs on Linux that allows planning trips in cars through maps. This software has different variations depending on the type of car, e.g. BMW, Audi, Hyundai, etc... Each variation has a dependency on common external components that are not compiled with the main source code and must be installed seperately in /local_components/... Some variations also have dependencies on components that are not required by other variations.

The standard way of knowing which components to install for the customer is to run a shell script that sets environment variables based on what variant you are wishing to build set in a config spec. This will set variables for all the external components required for compilation and runtime. The component variables have a standard naming convention based on versions. So there are some components that are upto version 2.0 and some with version 1.0, etc. Naming convention e.g. GPS_COMP_VER_2.0, COMMON_UTILITIES_VER_4.0. Once I determine what components are required by manually grepping the environment variables script I need to manually install the required components one by one by using rpm -i

I need to create a shell script to grep this script for all required components, so far I have this: env | grep '_VER_[0-9\-]*$'

I want to be able to analyse the results of this grep one by one and to then find the rpm package in a component library on a server. based on the version and install it automatically.

How would you suggest I go about this task? I am relatively new to shell scripting and am still learning on the job. So, any advice will be much appreciated!

Thanks!

As a start:
If there is different servers involved, you might want to communicate between them with ssh.
Checking if a grep was successful or not can be achived by testing $?. A zero would be success/true.