Prev: Redirecting to a stream number held in a variable
Next: how to configure mysql for debug installation
From: pradeep on 23 Dec 2009 19:25 ============================================= 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
From: Seebs on 23 Dec 2009 19:45 On 2009-12-24, pradeep <bansal.pradeep(a)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(a)seebs.net http://www.seebs.net/log/ <-- lawsuits, religion, and funny pictures http://en.wikipedia.org/wiki/Fair_Game_(Scientology) <-- get educated!
From: Ben Bacarisse on 23 Dec 2009 20:08 pradeep <bansal.pradeep(a)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.
From: Ben Finney on 23 Dec 2009 20:14
pradeep <bansal.pradeep(a)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 |