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 Martin On Wed, Aug 9, 2017 at 7:47 PM, bruce <badoug...@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@lists.fedoraproject.org > To unsubscribe send an email to users-le...@lists.fedoraproject.org >
_______________________________________________ users mailing list -- users@lists.fedoraproject.org To unsubscribe send an email to users-le...@lists.fedoraproject.org