You are not logged in.
Hello all,
I was wandering how I could flush the remaining data of a character device from a terminal.
Thanks in advance
Last edited by sakishrist (2012-10-25 11:08:25)
Offline
dd if=/dev/whatever of=/dev/null ?
Offline
I have a virtual machine with a login prompt set to spawn on a serial port.
This way I could send a some commands to the virtual machine. The problem though was that when I was reading the response, it could contain data previously sent through the port. So I would get multiple replies if I did something like this:
# echo "uname" > /dev/pts/2
# echo "date" > /dev/pts/2
# cat /dev/pts/2
Linux
Mon Oct 22 14:52:26 EEST 2012I was wandering if there is a simple way (non blocking, unlike dd) to get only the last result. Something like:
# do_something_to_flush /dev/pts/2But today, I have a different problem. There is no data kept at all in /dev/pts/2. I get nothing when I do:
# echo "date" > /dev/pts/2
# cat /dev/pts/2I have to type cat in one terminal and send the command through another to get results. I am really baffled by this change overnight.
Thanks in advance
Offline
dd has a "nonblock" option to turn off blocking I/O.
As for your new issue, I have no idea, and I especially don't know why it would behave differently when run from a different shell.
Offline