[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: bash quoting question



On Fri, 12 Oct 2001 16:47:07 +0200, Nadav Har'El <nyh@math.technion.ac.il> wrote:
> 
> On Fri, Oct 12, 2001, Tzafrir Cohen wrote about "bash quoting question":
> > It appears that the shell treats the value of DNS_RESOLVE as seperate
> > words, and even bothers quoting the "'" marks.
> > 
> > Any way around this?
> 
> In bash, the only solution I can think of now is using eval, like
> 	A="ls 'a b'"
> 	echo | eval $A 
  
Another way is to use the IFS special env variable.
    A='tr|A-Z | A-Z'            # shift a-z by 1 char lower
    echo "IBMA ?" | ( IFS="|" ; $A ) 
Of course you can use any character that suits you instead of "|" 
(e.g. ; or ! ).

It is simpler than Tzafrir own solution and bypass the eval problem.

Ehud.


BTW. Any one knows why I choose the above example (Hint: film) ? 

-- 
 Ehud Karni     Mivtach - Simon  Insurance   /"\
 Tel: +972-3-7966-561 Fax: +972-3-7966-667   \ /  ASCII Ribbon Campaign
 (USA) Fax and  voice  mail: 1-815-5509341    X   Against  HTML  Mail
     Better     Safe     Than     Sorry      / \
     mailto:ehud@unix.simonwiesel.co.il    http://www.simonwiesel.co.il

=================================================================
To unsubscribe, send mail to linux-il-request@linux.org.il with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail linux-il-request@linux.org.il