On 08/10/2017 10:07 AM, bruce wrote:
> the test was to (1) replicate the results I get from the cmdline.
> and to then (2) be able to pass a input/var to then generate the pgrep
> count results
>
> the initial cmdline pgrep -- pgrep -f 'bash' | wc -l
> -- on the test box, this returns a "50" coun
hey guys...
appears to be user error... looks like i was on the wrong/older box..
on the updated centos/fed.. looks as i expected... at least for now!
thanks..
On Wed, Aug 9, 2017 at 10:07 PM, bruce wrote:
> On Wed, Aug 9, 2017 at 9:52 PM, kevin martin wrote:
>> is the end result meant to be
On Wed, Aug 9, 2017 at 9:52 PM, kevin martin wrote:
> is the end result meant to be able to pass some string ($1) to pgrep that
> get's counted? knowing what you're trying to accomplish would make it
> easier to help.
>
> ---
>
-
hey kevin. sorry.
the test was to (1) replicate the
On 08/09/2017 05:47 PM, bruce wrote:
aa='bash'
xx="pgrep -f '"${aa}"' | wc -l"
echo $xx <<< this dsplays the test pgrep
echo `$xx` << err msg
echo `${xx}` << err msg...
eval "$xx"
or:
echo $(eval "$xx")
In the invocation you're trying to use, "|" is being passed as an
argument to pgre
is the end result meant to be able to pass some string ($1) to pgrep that
get's counted? knowing what you're trying to accomplish would make it
easier to help.
---
Regards,
Kevin Martin
On Wed, Aug 9, 2017 at 8:24 PM, bruce wrote:
> h update..
>
> this works...
> aa='bash'
> echo $aa
h update..
this works...
aa='bash'
echo $aa " pp"
xx= pgrep -f $aa | wc -l
echo $xx
however, I can't seem to figure out how to enclose the aa var in
single quotes within the pgrep.
thoughts/comments..
thanks
On Wed, Aug 9, 2017 at 8:47 PM, bruce wrote:
> trying to get the following t
unclear what you are trying to accomplish here. If, for example, you are
trying to pgrep for all processes that have 'bash' in the process name:
#!/bin/bash
aa='bash'
xx="pgrep -f ${aa} | wc -l"
echo $xx <<< shows the command in $xx
eval ${xx} <<< runs the command in $xx
---
Regards,
Kevin Ma
On 08/09/2017 05:47 PM, bruce wrote:
> trying to get the following to output
> pgrep -f 'bash' | wc -l
>
> the var $xx has the cmd...
> something's missing to allow the backtics to run the cmd..
> if the cmd is hadcoded.run, it works..
>
> can't see what the homer simpson "doh" moment is!