Prev: Building mysql extension/gem with MinGW (was Re: Gem build issuesUbuntu 9.10 64 bit)
Next: Can't install gems (Windows)
From: Kurtis Rainbolt-greene on 14 Jan 2010 20:39 So I've got this idea for a linux CLI program, and one of the things I want the program to do is notify Users of an event via the terminal. Is there something out there I can use to do this? I was thinking of using the WALL command, but that seems sloppy and requires reading from a file (for ubuntu). -- Posted via http://www.ruby-forum.com/.
From: Iñaki Baz Castillo on 14 Jan 2010 20:46 El Viernes, 15 de Enero de 2010, Kurtis Rainbolt-greene escribió: > So I've got this idea for a linux CLI program, and one of the things I > want the program to do is notify Users of an event via the terminal. > > Is there something out there I can use to do this? I was thinking of > using the WALL command, but that seems sloppy and requires reading from > a file (for ubuntu). WALL command doesn't require reading from a file, it reads the STDIN. When you do "wall < FILE" you are redirecting the STDIN to the file, so the content of the file is passed to wall via STDIN. When you run "wall" (just "wall") you must insert text with the keyboard and press Ctrl+D to exist and deliver the message. So in Ruby you could redirect the STDIN (better $stdin) to invoke the system command (not sure now how to achieve it but sure it's possible). -- Iñaki Baz Castillo <ibc(a)aliax.net>
From: Jonathan Nielsen on 14 Jan 2010 21:03 >> Is there something out there I can use to do this? I was thinking of >> using the WALL command, but that seems sloppy and requires reading from >> a file (for ubuntu). > > WALL command doesn't require reading from a file, it reads the STDIN. > > When you do "wall < FILE" you are redirecting the STDIN to the file, so the > content of the file is passed to wall via STDIN. > > When you run "wall" (just "wall") you must insert text with the keyboard and > press Ctrl+D to exist and deliver the message. > > So in Ruby you could redirect the STDIN (better $stdin) to invoke the system > command (not sure now how to achieve it but sure it's possible). > Yes, use popen3 to get a reference to stdin of the wall process and write into the stdin. Should work anyway... -Jonathan Nielsen
From: Albert Schlef on 15 Jan 2010 00:43 Kurtis Rainbolt-greene wrote: > So I've got this idea for a linux CLI program, and one of the things I > want the program to do is notify Users of an event via the terminal. I think this utility already exists: syslog. It can also output certain messages to the terminal. -- Posted via http://www.ruby-forum.com/.
From: Iñaki Baz Castillo on 15 Jan 2010 04:17
El Viernes, 15 de Enero de 2010, Jonathan Nielsen escribió: > >> Is there something out there I can use to do this? I was thinking of > >> using the WALL command, but that seems sloppy and requires reading from > >> a file (for ubuntu). > > > > WALL command doesn't require reading from a file, it reads the STDIN. > > > > When you do "wall < FILE" you are redirecting the STDIN to the file, so > > the content of the file is passed to wall via STDIN. > > > > When you run "wall" (just "wall") you must insert text with the keyboard > > and press Ctrl+D to exist and deliver the message. > > > > So in Ruby you could redirect the STDIN (better $stdin) to invoke the > > system command (not sure now how to achieve it but sure it's possible). > > Yes, use popen3 to get a reference to stdin of the wall process and > write into the stdin. Should work anyway... With popen4 you also get the correct exit status code of the command :) -- Iñaki Baz Castillo <ibc(a)aliax.net> |