On Mon, 13 Sep 2004 02:17 pm, Alexander Samad wrote: > Hi > Quick question for the list > > I am trying to do something like this > #!/bin/bash > SOMEVARIABLE > VAR2="$( awk -F, "/$SOMEVARIABLE/ /some/pathtoafile/")" > > Now I have problems with my " I can't use ' because I want SOMEVARIABLE > to be subsituted I have tried > > VAR2="$( awk -F, \"/$SOMEVARIABLE/ /some/pathtoafile/\")" > > but it starts going haywire! > > Alex
Have you tried protecting the variable from the shell per the "man bash" instructions like this: VAR2="$( awk -F, "/${SOMEVARIABLE}/ /some/pathtoafile/")" BTW - that line above looks a little odd. I'd try it like this instead: VAR2=`awk -F, '/${SOMEVARIABLE}/ /some/pathtoafile/'` The enclosing a variable between curly braces, eg, ${foo} will force the shell to expand the variable's content regardless of whether it is inside single or double quotes. IIRC. Cheers, James -- SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/ Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html