Hi Guys..
I have a script which is:
#!/bin/ksh
for file in `grep qtc $PIC_SHS/xback00.ksh |cut -d"=" -f2`
do
ls $file
cp $file ./
done
output of grep is
$ grep qtc $PIC_SHS/xback00.ksh |cut -d"=" -f2
$PIC_BIN/XPBACKRC0.qtc
$PIC_BIN/XPBACK000.qtc
$PIC_BIN/XPBACKSS0.qtc
$PIC_BIN/XPBACKSP0.qtc
$PIC_BIN/XPBACKAL0.qtc
$PIC_BIN/XPBACKBO0.qtc
$PIC_BIN/XPBACKTC0.qtc
$PIC_BIN/XPBACKFC0.qtc
$PIC_BIN is a environment variable.
$ ls -l $PIC_BIN/XPBACKRC0.qtc
-rwxrwxrwx 1 ddshupmg gmwms 8448 Feb 7 2007 /disk1/uketddshup/common/bin/XPBACKRC0.qtc
the files exist.. but when give the grep output as input list to for loop, it doesnt evaluate it.. and gives an error like :
$ ./copy.ksh
$PIC_BIN/XPBACKRC0.qtc: No such file or directory
cp: cannot access $PIC_BIN/XPBACKRC0.qtc
$PIC_BIN/XPBACK000.qtc: No such file or directory
cp: cannot access $PIC_BIN/XPBACK000.qtc
$PIC_BIN/XPBACKSS0.qtc: No such file or directory
cp: cannot access $PIC_BIN/XPBACKSS0.qtc
$PIC_BIN/XPBACKSP0.qtc: No such file or directory
cp: cannot access $PIC_BIN/XPBACKSP0.qtc
$PIC_BIN/XPBACKAL0.qtc: No such file or directory
cp: cannot access $PIC_BIN/XPBACKAL0.qtc
$PIC_BIN/XPBACKBO0.qtc: No such file or directory
cp: cannot access $PIC_BIN/XPBACKBO0.qtc
$PIC_BIN/XPBACKTC0.qtc: No such file or directory
cp: cannot access $PIC_BIN/XPBACKTC0.qtc
$PIC_BIN/XPBACKFC0.qtc: No such file or directory
cp: cannot access $PIC_BIN/XPBACKFC0.qtc
Any idea how to evaluate the variable in for loop.. at shell level it works..