On Wed, Aug 9, 2017 at 9:52 PM, kevin martin <ktmdms(a)gmail.com> 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 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" count
in testing using php/bash -- i get a "51"
#!/bin/bash -f
#
# ptest.sh
#
pgrep -f 'bash' | wc -l
------------------------------------
on the test centos box, there is no pgrep -c << option.. haven't
checked the fedora yet
however, if i replace "bash" with a procname that doesn't exist.. it
correctly returns "0"..
So, I was/am trying to wrap my head around what's going on.
thanks
>
> Regards,
>
> Kevin Martin
>
> On Wed, Aug 9, 2017 at 8:24 PM, bruce <badouglas(a)gmail.com> wrote:
>>
>> hmmmm 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 <badouglas(a)gmail.com> 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!
>> >
>> > thanks
>> >
>> >
>> >
>> > #!/bin/bash
>> > #
>> > # ptest.sh
>> > #
>> > # use predefined variables to access passed arguments
>> > #
>> > # $1
>> > aa=$1
>> > aa='bash'
>> > echo $aa " pp"
>> > xx="pgrep -f '"${aa}"' | wc -l"
>> > echo $xx <<< this dsplays the test pgrep
>> > echo `$xx` << err msg
>> > echo `${xx}` << err msg...
>> >
>> > ## trying to get -- pgrep -f 'bash' | wc -l <<
>> > ## i'm getting a Usage: pgrep [....] err msg..
>> _______________________________________________
>> users mailing list -- users(a)lists.fedoraproject.org
>> To unsubscribe send an email to users-leave(a)lists.fedoraproject.org
>
>
>
> _______________________________________________
> users mailing list -- users(a)lists.fedoraproject.org
> To unsubscribe send an email to users-leave(a)lists.fedoraproject.org
>