[PLUG] shell scripting

Roderick A. Anderson raanders at cyber-office.net
Mon Oct 26 21:27:17 UTC 2009


Lemseffer. Tahar (MSA) wrote:
> Example as follow:
> 
> LIST = 'ypcat hosts|| sort | awk '{print $2}''
>  for Devices in $LIST

I suggest you modify the two lines above to this one so you're not 
running into the interesting side effects of bash variable assignments 
and confusion of apostrophes & back-ticks.

    for Devices in $(ypcat hosts|| sort | awk '{print $2}') \

Though I'm a little confused by the or (||) in that statement.  I would 
have thought you wanted the results of ypcat to be piped to sort.


\\||/
Rod
-- 
>  do
>  Value=`snmpget -v1 -c privator $Devices snmpInBadCommunityNames.O
>  |awk '{print $4}' `
>  "check for intrusion on all devices, if there is none should return a
> zero" 
> 
> Thanks again
> T
> 
> -----Original Message-----
> From: plug-bounces at lists.pdxlinux.org
> [mailto:plug-bounces at lists.pdxlinux.org] On Behalf Of Robert Citek
> Sent: Monday, October 26, 2009 10:23 AM
> To: General Linux/UNIX discussion and help,civil and on-topic
> Subject: Re: [PLUG] shell scripting
> 
> On Mon, Oct 26, 2009 at 1:09 PM, Lemseffer. Tahar  (MSA)
> <lemseffert at sacsewer.com> wrote:
>> Thank you Robert,
>>
>> The code will output the list of my hosts file.
> 
> That's what it should do.  I suspect it may not.  For example, here's
> what I get when I run it from the command line:
> 
> $ LIST = 'ypcat hosts|| sort | awk '{print $2}''
> -bash: LIST: command not found
> 
> Regards,
> - Robert
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug
> ____________________________________________________________________________
> EMAIL DISCLAIMER:
> This email and any attachments thereto may contain private, confidential, and
> privileged material for the sole use of the intended recipient. Any review,
> copying, or distribution of this email (or any attachments thereto) by other
> than the intended recipient is strictly prohibited.
> 
> If you are not the intended recipient, please contact the sender immediately
> and permanently delete the original and any copies of this email and any
> attachments thereto.
> _____________________________________________________________________________
> 
> _______________________________________________
> PLUG mailing list
> PLUG at lists.pdxlinux.org
> http://lists.pdxlinux.org/mailman/listinfo/plug




More information about the PLUG mailing list