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 <badouglas@xxxxxxxxx> 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@xxxxxxxxx> 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@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@lists.fedoraproject.org
_______________________________________________ users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx