[wplug] very simple bash question..

Mike techmike at gmail.com
Thu Mar 17 12:58:02 EST 2005


Perfect!  Thanks!


On Thu, 17 Mar 2005 09:32:42 -0500, Eric Cooper <ecc at cmu.edu> wrote:
> On Thu, Mar 17, 2005 at 09:21:35AM -0500, Chris Romano wrote:
> > On Thu, 17 Mar 2005 09:18:54 -0500, Mike <techmike at gmail.com> wrote:
> > > How would I store a programs output to a variable?
> > >
> > > I want to take the output of
> > >
> > > ps aux | wc -l
> > >
> > > and store it so I can do some math with it.
> >
> > var=`ps aux | wc -l`
> >
> > make sure there are no spaces between the "="
> 
> or: var=$(ps aux | wc -l)
> 
> This form is useful because it nests, unlike the backticks.
> 
> --
> Eric Cooper             e c c @ c m u . e d u
> _______________________________________________
> wplug mailing list
> wplug at wplug.org
> http://www.wplug.org/mailman/listinfo/wplug
>


More information about the wplug mailing list