csh and stdin from pipes/files

csh and stdin from pipes/files

Post by Morten Bogesko » Tue, 08 Apr 1997 04:00:00



Hi..

 I was wondering if it is possible to assign a pipe or a file to the
standardin. So the "$<" expression takes the line from the pipe or file
instead of the keyboard.

... program using stdin (keyboard)
do_something_wierd -lineoutput | ....
set line_n = $<

And I would like to avoid the
| ( \
set line_n = $<; \
...
)
syntax

Thansk in advance

Which one of my enemies told you I am paranoid?

 
 
 

csh and stdin from pipes/files

Post by Icarus Spar » Fri, 11 Apr 1997 04:00:00




Quote:> I was wondering if it is possible to assign a pipe or a file to the
>standardin. So the "$<" expression takes the line from the pipe or file
>instead of the keyboard.

>... program using stdin (keyboard)
>do_something_wierd -lineoutput | ....
>set line_n = $<

>And I would like to avoid the
>| ( \
>set line_n = $<; \
>...
>)
>syntax

CSH is not able to manipulate file descriptors, so no. This is one reason why
people are told not to use csh for scripting.

$< reads from standard input, and if your standard input is the keyboard
then it can not be a pipe!

You might be able to do
set line_n=`do_something_wierd -lineoutput`
to do what you want instead.

Icarus

 
 
 

1. Piping - from a file then return to reading from stdin

Is this any way to start a pipe (say to give answers to the first several
prompts for a command) and and then switch over to stdin?

Sortof like a cat file stdin | command type of thing...

-- Nathan

---------------------------------------------------------------

2. Solaris 8 6/00L Solstice problem - where is Adminsuite?

3. piped data & 'read' stdin

4. Changing

5. Reading a line from stdin using SCO csh

6. DEBIAN: KDE2.2.2 on Potato

7. to pipe the stderr to stdin

8. SCSI Controller Card

9. Q: pipe into telnet per stdin?

10. How can csh detect EOF on stdin?

11. Redirecting stdin in CSH

12. pipin' problems - stdin & stdout messed up after executing piped command

13. stdin redirect works, pipe fails