read from terminal


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting read from terminal
# 1  
Old 10-21-2005
read from terminal

If I do:

cat file | write user

I can cat a file to a users terminal. My question is, how can this user read the input and cat it into a file?

I tried the reverse:

read | file
or
read > file
etc.
But it didn't work.
# 2  
Old 10-21-2005
Try this:
Code:
cat > file
this is a test file
this is the second line of the test file
^D ## this is ctrl-D

The ^D char at the end is the EOF character. On receiving this char, cat will stop reading the stdin of the user and close the file.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Print Terminal Output Exactly how it Appears in the Terminal to a New Text File

Hello All, I have a text file containing output from a command that contains lots of escape/control characters that when viewed using vi or view, looks like jibberish. But when viewed using the cat command the output is formatted properly. Is there any way to take the output from the cat... (7 Replies)
Discussion started by: mrm5102
7 Replies

2. Shell Programming and Scripting

Cannot get terminal application to launch with a graphical launcher when successful in terminal

I have been having an extremely annoying problem. For the record, I am relatively new at this. I've only been working with unix-based OS's for roughly two years, mostly Xubuntu and some Kali. I am pretty familiar with the BASH language, as that's the default shell for debian. Now, I've made this... (16 Replies)
Discussion started by: Huitzilopochtli
16 Replies

3. OS X (Apple)

Read and manage mail under Terminal

When opening Terminal window under Mac OS Lion, I have a message saying I've got mail . It seems to be somewhere close to ~/Library/Server/Mail/Data/spool/ but I ignore what command to be typed in order to read it and suppress it later once read. (1 Reply)
Discussion started by: shub22
1 Replies

4. UNIX for Dummies Questions & Answers

read from terminal/keyboard > /dev/tty

Hi, I need to provide more than one character to "> /dev/tty" through terminal/keyboard input, I have this: ok=false while do echo " Enter r1 to reformat " > /dev/tty read choice case $choice in ) echo " bla bla bla " ;; done However, in this way,... (3 Replies)
Discussion started by: Gery
3 Replies

5. UNIX for Dummies Questions & Answers

read a .bin through terminal and output a checksum?

Hi all, Ive been given a .bin file that I want to do a checksum on to make sure that it is consistant with what I know should be the checksum. I have tried using md5sum but it spits out a 128 bit line rather than a 32 bit line, which is what I want. Can someone help set me off in the right... (7 Replies)
Discussion started by: TeamUSA
7 Replies

6. Programming

How to read terminal attributes using ioctl()

I want to get the terminal attributes such as , terminal width terminal height current cursor position Can I use ioctl function. Please help me how to use this function to get these details.. If possible please explain with a sample code. I'm very new to UNIX progrmming.... Thanks... (1 Reply)
Discussion started by: Sreejesh.S
1 Replies

7. Programming

read terminal command

hi how to read terminal command, just i want to read all command which write on terminal so please tell me any system call, api avilable in c for above purpose (6 Replies)
Discussion started by: munnu
6 Replies

8. UNIX for Dummies Questions & Answers

How to read lock terminal values in solaris

Hi all I am using sun solaris 5.8. I wanna know where the value stored if we lock/unlock the terminal and how i can read and use it to my script. I am helpless . So plzzzzzz... (0 Replies)
Discussion started by: pankajarora_12
0 Replies

9. Shell Programming and Scripting

Terminal Hungup at the time of read

Hi, There are two scripts. The second script is called from the first one. These will create two processes on unix. In the second script, there is a read statement in the while loop. Under unexpected conditions, at the time of reading response from the user, if the terminal hungup happens,... (1 Reply)
Discussion started by: pkusumam
1 Replies

10. UNIX for Advanced & Expert Users

connecting to unix through hyper terminal - as a dumb terminal

I just changed from windows NT to XP and I am no longer able to connect to my unix system. I used to use hyper terminal -- which acts as dumb terminal to my main frame unix system. I think one of the options used to be "direct to comX". This option isn't listed now. I use a serial port and the... (2 Replies)
Discussion started by: michelle
2 Replies
Login or Register to Ask a Question