I am new with unix and I am writing a shell script.
When I run this line on the command prompt, it prints the total count of the number of processes which matches:
ps -ef | awk '/siebsvc –s siebsrvr/ && !/awk/ { a++ } END { print a }'
example, the output of the above line is 2 in the command prompt.
I want to write a shell script in which the output of the above line (2) is assigned to a variable, which will be later be used for comparison in an if statement.
I am looking for something like
output= `ps -ef | awk '/siebsvc –s siebsrvr/ && !/awk/ { a++ } END { print a }'`
echo $output
But when i run it, it says output could not be found whereas I am expecting 2. Please help.
You can use a $
sign like:
OUTPUT=$(expression)