Re: simple shell script question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <badouglas@xxxxxxxxx> wrote:
> On Wed, Aug 9, 2017 at 9:52 PM, kevin martin <ktmdms@xxxxxxxxx> 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@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@xxxxxxxxxxxxxxxxxxxxxxx
>>
>>
>>
>> _______________________________________________
>> users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
>> To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
>>
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx



[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [EPEL Devel]     [Fedora Magazine]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Desktop]     [Fedora Fonts]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Fedora Sparc]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux