OT: need bash help [solved]

Mike Wright mike.wright at mailinator.com
Mon Oct 17 19:45:01 UTC 2011


On 10/17/2011 12:39 PM, Mike Wright wrote:
> Hi all,
>
> I'm trying to write a bash script and having problems.
>
> If I execute this:
>
>     ps x | grep mongod | wc -l
>
> it returns a value.
>
> OTOH, if I execute this:
>
>     LINES = ps x | grep mongod | wc -l
>
> it returns "command not found".
>
> How does one assign the output of a command to an environment variable?

Aaargh!  Doesn't like the spaces around the = sign.

LINES=`ps x | grep mongod | wc -l` is a way to write it.

Sorry for the noise :/


More information about the users mailing list