the output of both is the same .. could anyone please explain the working dynamcis ?

Thanks

Recommended Answers

All 5 Replies

See This.

thanks ..
aslo how to open a file in shell scripting that has been input as an argument ? (not using cat or vi)
does open work here ?
I need to read the lines off the file and process.

thanks again.

What do you mean "process"? If you mean you want to edit the lines of file, you CAN'T (AFAIK). Not the way you think, unless you want to use the "e" command (or something similar) to do line editing. Otherwise, it is best to use a for loop over a cat command and read the lines, writing to a new file, then replacing the old file with the new file.

hi,

use a for loop over a cat command and read the lines

no! that's UUOC (at least).

while read -r line; do echo "$line"; done <file >newFile
mv newFile file

no! that's UUOC (at least).

Correct. Its been years since I have had to do that.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.