![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem with socket reading | swap007 | UNIX for Advanced & Expert Users | 2 | 05-20-2008 10:08 PM |
| Problem reading a 4mm tape drive | tdpearson | AIX | 2 | 05-24-2007 09:34 AM |
| problem in reading file using fread | arunkumar_mca | High Level Programming | 4 | 10-30-2006 05:02 PM |
| Reading file names from a file and executing the relative file from shell script | anushilrai | Shell Programming and Scripting | 4 | 03-10-2006 02:25 AM |
| Reading a CSV file into shell variables problem | multidogzoomom | Shell Programming and Scripting | 6 | 10-11-2005 01:43 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
help me ...problem in reading a file
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? |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Code:
#! /bin/ksh set -f while read line do echo $line done |
|
#3
|
|||
|
|||
|
Hi,
Try following #!/bin/ksh cat <filename> | while read record do echo $record done Best Regards, Sridhar M Quote:
|
|
#4
|
|||
|
|||
|
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 |
|
#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).
|
|
#6
|
||||
|
||||
|
Another solution :
Code:
#! /bin/ksh while read line do echo "$line" done Jean-Pierre. |
|
#7
|
||||
|
||||
|
Quote:
I have a feeling it is there but it might be in the zshbuiltins man page. |
||||
| Google The UNIX and Linux Forums |