hi,
while reading a file line by line
# name of the script is scriptrd
while read line
do
echo $line
done
while executing
bash$ ./scriptrd
if i give the input as
*
the output is like it displays the contents of the current directory
i jus wanted it to print as *
can anybody help me in this?
vino
June 19, 2006, 6:18am
2
#! /bin/ksh
set -f
while read line
do
echo $line
done
Look into man ksh for the -f option under set. Or look for noglob.
msridh
June 19, 2006, 6:46am
3
Hi,
Try following
#!/bin/ksh
cat <filename> | while read record
do
echo $record
done
Best Regards,
Sridhar M
brkavi_in:
hi,
while reading a file line by line
# name of the script is scriptrd
while read line
do
echo $line
done
while executing
bash$ ./scriptrd
if i give the input as
*
the output is like it displays the contents of the current directory
i jus wanted it to print as *
can anybody help me in this?
Hi vino,
that was perfectly working....thank you very much.
sridhar,that code results in the same error....but thanks for responding.
Both of you have worked it out in ksh...
but it works in bash too.
is that shell specific or what? whatz the difference?
Thanks and Regards,
Kavitha
vino
June 19, 2006, 7:45am
5
Yes it does work with bash and ksh. noglob is not shell specific. But if you go into other shells say zsh, then noglob does not exist (Atleast I couldnot find it in the man pages).
aigles
June 19, 2006, 9:22am
6
Another solution :
#! /bin/ksh
while read line
do
echo "$line"
done
Jean-Pierre.
reborg
June 19, 2006, 12:41pm
7
I have a feeling it is there but it might be in the zshbuiltins man page.