View Single Post

   
  #3 (permalink)  
Old 02-15-2008, 10:00 AM
Bill Campbell
 
Posts: n/a
Default Re: Unix equivalent of Dos commands

On Wed, Jun 25, 2003 at 10:44:19AM -0600, justin wrote:
>I am trying to send strings of data to a customer display connect to
>/dev/tty2a in Openserver 5.0.5. The use manual explains how to do this in
>dos, but I want to test in out in unix. The manual says to do the following
>dos commands:
>
>mode com1 96,n,8,1
>type con>com1
>
>then type "!#1ABCDEFGH" and press enter. The display will show "ABCDEFGH"
>on the first line. Press Ctrl-C to end.
>
>In dos, I can sit there all day and type in various strings and it works,
>but I don't know how to do this in unix. I believe that I have the settings
>for tty2a set correctly as I can type echo $string > /dev/tty2a and it
>displays. The problem with this testing is that the device has to be reset
>after each line because it needs a cr/lf to end one line and begin accepting
>another.


The ususal answer is ``there's more than one way to do it''. The Unix
``write'' command is traditionally the way this is done.

Writing directly to a user's tty device may work, but probably won't on a
properly configured system since it has many security implications. (how
would you like to be running as root and have your F1 key reprogrammed to
send ``rm -fr /'')?

Things are muth more compilicated in a multi-user environment than on the
average DOS/Windows machine where there's only one user with one console
device. Even if I'm running an *ix box from the console, there are 12
different ttys I might be on so how do you know which one to write to (when
I was running Xenix I used all 12 of them)?

Bill
--
INTERNET: bill@Celestial.COM Bill Campbell; Celestial Software LLC
UUCP: camco!bill PO Box 820; 6641 E. Mercer Way
FAX: (206) 232-9186 Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/

``It is better to die on your feet than to live on your knees!''
-- Emiliano Zapata.
Reply With Quote