error while executing ksh script

  • Follow


=============================================
i=6;
output=`policymgr_show -A -B 0x7 > /dev/null | grep -E "input"'
for femname in $output; do
        rp_exec[i]="show policy-map type performance-traffic $femname"
        i=$(($i + 1))
    done

============================================

on running the above script, I am getting this error. I am kind of new
to shell. Please help
abc[8]: no closing quote
0
Reply pradeep 12/24/2009 12:25:31 AM

On 2009-12-24, pradeep <bansal.pradeep@gmail.com> wrote:
>=============================================
> i=6;
> output=`policymgr_show -A -B 0x7 > /dev/null | grep -E "input"'
> for femname in $output; do
>         rp_exec[i]="show policy-map type performance-traffic $femname"
>         i=$(($i + 1))
>     done
>
>============================================
>
> on running the above script, I am getting this error. I am kind of new
> to shell. Please help
> abc[8]: no closing quote

You've matched a ` and a '.  That is not how the shell works.  Match ` with
` and ' with '.

-s
-- 
Copyright 2009, all wrongs reversed.  Peter Seebach / usenet-nospam@seebs.net
http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures
http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
0
Reply Seebs 12/24/2009 12:45:55 AM


pradeep <bansal.pradeep@gmail.com> writes:

> =============================================
> i=6;
> output=`policymgr_show -A -B 0x7 > /dev/null | grep -E "input"'

This.....^ open quote is not closed.  I suspect you intended....` here.

<snip>
> abc[8]: no closing quote

-- 
Ben.
0
Reply Ben 12/24/2009 1:08:07 AM

pradeep <bansal.pradeep@gmail.com> writes:

> =============================================
> i=6;
> output=`policymgr_show -A -B 0x7 > /dev/null | grep -E "input"'
[…]

Since you're using ksh, you have the standard, nestable POSIX command
expansion syntax available instead of the backticks.

    output=$(policymgr_show -A -B 0x7 > /dev/null | grep -E "input")

This has the additional advantage that you don't need to quote any
additional characters to make them survive inside the command expansion.

-- 
 \         “All my life I've had one dream: to achieve my many goals.” |
  `\                                            —Homer, _The Simpsons_ |
_o__)                                                                  |
Ben Finney
0
Reply Ben 12/24/2009 1:14:20 AM

3 Replies
927 Views

(page loaded in 0.076 seconds)

Similiar Articles:













7/23/2012 8:51:38 AM


Reply: