[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Passing the results of GREP into a Bash Variable

From: Robert A. Adkins II
Subject: Passing the results of GREP into a Bash Variable
Date: Wed, 11 Jul 2001 01:29:36 GMT


    I am working on a script that requires the result of a grep to be
piped or entered into a variable for an if, then, else check. Is that at
all possible?

    My current thinking, is that I would need to cat the grep result
into a file and then read the file into the variable. The grep is
looking for something incredibly specific that will only be in the file
once. So, the variable should be a simple string. I am writing a task
automation tool that needs to check if a service is running. If the
service is running the script will exit. If not, then the script will
call another script that will fire-up the job.

    This is not something that can be done by cron or at, as it is
something that will happen when a user logs into the system at the
command line. The original script will be called immediatly upon user
login. Once that is done, the script will determine whether or not it
needs to run, if it needs to run then it will call the other scripts and
set things in motion.

    Thanks much for you help,

    Robert Adkins II

reply via email to

[Prev in Thread] Current Thread [Next in Thread]