1755164 Members
3406 Online
108830 Solutions
New Discussion

Query on scripting

 
SOLVED
Go to solution
James R. Ferguson
Acclaimed Contributor

Re: Query on scripting

Hi (again):

One advantage to Jean-Philippe's use of a unique file descriptor would be seen if your read loop invoked an interactive command, like 'rm -i' to remove files. In that case, you need to keep one file descriptor for the file read (here, #3) and allow the standard file descriptor (STDIN or #0) to be used by 'rm -i ${i}'.

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: Query on scripting

>JRF: One advantage to Jean-Philippe's use of a unique file descriptor would be seen if your read loop invoked an interactive command, like 'rm -i' to remove files. In that case, you need to keep one file descriptor for the file read and allow the standard file descriptor (STDIN) to be used by 'rm -i ${i}'.

It is possible that rm(1) isn't reading from stdin, most likely stderr? tusc will tell you.

I thought of that solution the last time we had that "while ssh/remsh ... with -n" eating up stdin.