2011-12-20, 14:18(-08), kc123:
[...]
> Could someone please help me figure out why:
> GNU bash, version 3.2.25(1)-release-(x86_64-redhat-linux-gnu)
[...]
Since you're using RedHat Linux, try
ps -o comm= -C crond
--
Stephane
'ps -e'. You are matching your own
> grep becuase it is in the argument list.
>
> Then this can be made smarter by simply matching it as a string
> instead of as a pattern.
>
> ps -e | awk '$NF=="crond"'
>
> ps -e | awk '$NF=="crond"{print$1}'
>
> Bob
>
>
>
--
View this message in context:
http://old.nabble.com/return-values-of-bash-scripts-tp33012795p33017874.html
Sent from the Gnu - Bash mailing list archive at Nabble.com.
On Tue, Dec 20, 2011 at 02:18:16PM -0800, kc123 wrote:
> content=`ps auxw | grep [c]rond| awk '{print $11}'`
http://mywiki.wooledge.org/ProcessManagement
> echo "CONTENT:" $content
http://mywiki.wooledge.org/Quotes
http://mywiki.wooledge.org/Arguments
I would strongly advise that you state what
Mike Frysinger wrote:
> kc123 wrote:
> > For example, my script below called crond.sh:
> > ...
> > content=`ps auxw | grep [c]rond| awk '{print $11}'`
> > ...
> > and output is:
> > CONTENT: /bin/bash /bin/bash crond
> >
> > Why are there 2 extra arguments printed (/bin/bash) ?
>
> because you gr
On Tuesday 20 December 2011 17:18:16 kc123 wrote:
> For example, my script below called crond.sh:
> ...
> content=`ps auxw | grep [c]rond| awk '{print $11}'`
> ...
> and output is:
> CONTENT: /bin/bash /bin/bash crond
>
> Why are there 2 extra arguments printed (/bin/bash) ?
because you grepped y
. Would like to just
output "crond".
Many thanks.
--
View this message in context:
http://old.nabble.com/return-values-of-bash-scripts-tp33012795p33012795.html
Sent from the Gnu - Bash mailing list archive at Nabble.com.