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

OT: quoting variable names in shell scripts



Consider the following shell script

$cat manual_listing.sh                                                                                                                                                                                         
#! /bin/sh

# stanza 1
for i in "kama" "raju" "k a m a" "r a j u"
do
        echo $i
done

# stanza 2
names='kama raju'
for i in $names
do
        echo $i
done


If I run this, I get
$./manual_listing.sh                                                                                                                                                                                          
kama
raju
k a m a
r a j u
kama
raju

I am wondering if there is a way to rewrite the names variable in stanza2 
such that the output from stanza 1 and stanza 2 are the same.

thanks in advance
raju
-- 
Kamaraju S Kusumanchi
http://malayamaarutham.blogspot.com/


Reply to: