How can I write to another user's pseudo tty, but not to its current prompt position (as in open("/dev/pts007", ...) followed by write() ). Instead I would like to write to the top center of the screen using color red, for example. Like curses, but from another console.
There is no way to do that without encountering unsolvable problems.
If you have write permission, you can spit out a sequence of characters and hope for the best. wall does that and the message is sometimes garbled.
You can ask the user to shutdown his program and run a program that you wrote instead. This program can read his environment and learn how to configure his terminal. talk does that and it works fairly well.
It sounds like it is contacting that specific process and requesting that a message be displayed. That is similiar to the talk model. Since you're on SunOS, you can use truss to see exactly what it is doing.
Actually it's OpenUnix Caldera but truss works just the same.
Here is the interesting part:
So I guess these are control sequences at the beginning/end. Are they hex? There is a special .tinfo file but the entries are of the type:
...
kf2=\E[N, kf3=\E[O
...
Last edited by Yogesh Sawant; 05-26-2010 at 03:07 AM..
Reason: added code tags
When truss is displaying a string, it will display the character if it is printable and it puts a space between the letters. If the character is not printable is outputs in hex and in this case it will need two positions, so you lose the space.
1B is an escape character. You can see it (maybe) with "man ascii". Octal is a little more common in the unix world. You can convert hex to octal via bc. Quick example:
echo "obase=8;ibase=16;1B" | bc
Those are usually called escape sequences. Once you know that an escape is 33 in octal, you can model this in ksh:
The sleep will delay the printing of your prompt long enough to see what happened. The first and last escape sequences are mysteries to me. The second moves the cursor. The third is an sgr (select graphic rendition) The 1 goes to bold mode. I have no idea what the 31 is supposed to do. It is a nop with my xterm. And this leaves my terminal in bold mode. I had to do a "tput sgr0" to fix it.
But if I was using hpterm instead of xterm, this would not work at all. That is the problem with this sort of thing, you must guess at the user's terminal.
Last edited by Yogesh Sawant; 05-26-2010 at 03:08 AM..
Reason: added code tags
Thanks,
I think they are:
1B [ s sc to save cursor
1B [ 1 ; 3 8 H cup to position cursor
1B [ 3 1 ; 1 m changes color to red
1B [ u rc to restore cursor
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)
How can I have all my output to a terminal pager by default.
I want all output to pause once screen is full.
Piping to more does not work if the app/script is interactive (2 Replies)
i make a shell script. There has a line wget
https://cisofy.com/files/lynis-2.1.0-88394c1affb9e23bd7390098947b3fd4b04e35e8.tar.gzWhen this line execute terminal show some text like this
Resolving cisofy.com (cisofy.com)... 149.*.*.*
Connecting to cisofy.com (cisofy.com)|149.*.*.*|:4444...... (4 Replies)
When ever i started my terminal,Every time I have to change the directory like "cd user/documents/ravi/folder2/folder3" Without typing this entire command every time ,I placed "alias c='cd user/documents/ravi/folder2/folder3'" in .bash_profile file. so that i can able to execute command 'c'... (6 Replies)
Hello
Using BASH under Ubuntu 10.4 lts + XMonad
My script is almost perfect but i'm stuck at the last hurdle:
I need a sort of modified 'echo' which truncates its output to the width of the terminal
I can find the terminal's width with 'stty size' but i dont know how to then convert input... (2 Replies)
Hi,
I'm trying to come up with a simple expect script that allows me to login to a system and run a single command ... something like this:
#!/usr/bin/expect -f
# let's set some variables
#set password
set ipaddr
set ponumber
set hostname
set timeout -1
# let's now connect to the... (0 Replies)
Hey,
How can I transfer the terminal output to a file ?
For example :
command "fuser" returns the "process-id" and prints the output on the terminal, but I want that output to a file as well. How can I do that ?
/clocal/mqbrkrs/user/mqsiadm/sanjay/AccessMonitor $ fuser -uf... (2 Replies)
Hi all,
i type a command along with dtterm what i would like to have is that the output of the command to be shown in the new terminal .
Any Idea on how to acheive this? (0 Replies)
I have a window open on my ultra 10 - a terminal window connecting to a server.
Is there any way I can log all output to this window to a log file on my ultra 10 ? (2 Replies)
Hi all
The makefile of a large project produces hundreds of lines of output, which I can't look at any more when the build is finished. If I simply redirect the output to a file, I can't see the progress of the building process...
Is there a possibility to redirect the output to a file and at... (1 Reply)