- write command - "pretty-up output"
- Posted by ritchie on January 16th, 2004
Hi all,
I am writing to ask about the .bashrc file.
Does anyone know what can be included in this file?
I am trying to setup the output from a write command. Is this the
file I need to edit? (Using bash).
Does anybody know what I need to do in order to, say, display a
border, colors... , around my text for a write command?
Thanks a million,
Ritchie
- Posted by Dances With Crows on January 16th, 2004
On 16 Jan 2004 12:39:12 -0800, ritchie staggered into the Black Sun and
said:
Usually, you put things like environment variable settings and aliases
in ~/.bashrc . Whatever you put in ~/.bashrc should generate no output
as this will break scp and rcp. A snippet of my .bashrc is:
test -e ~/.alias && . ~/.alias
export PS1='\[\033[01;32m\]\h:\[\033[01;34m\]\w\$ \[\033[00m\]'
The first line checks for the existence of ~/.alias ; if ~/.alias
exists, that file is executed with the . command. The second line sets
the environment variable PS1 to that ugly-looking string. PS1 is the
prompt that you see, and the PS1 above gives you the hostname of the
current machine in green, followed by the current working directory in
blue.
Not enough info to tell. What kind of output does this unnamed "write
command" produce? What is it you want to do? Read
http://catb.org/~esr/faqs/smart-questions.html and follow its advice.
You can do some simple things with colors using echo and the man page
for console_codes. You can do more complex things using "dialog", a
program for displaying dialog boxes and menus on a console or xterm. If
you need more flexibility than that, Google for "ncurses tutorial" but I
don't think you'll have to go that far.
--
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin / mail: TRAP + SPAN don't belong
http://www.brainbench.com / Hire me!
-----------------------------/ http://crow202.dyndns.org/~mhgraham/resume
- Posted by ritchie on January 17th, 2004
Hi,
Thanks for the reply.
Sorry for the unclear question before.
I have read over http://catb.org/~esr/faqs/smart-questions.html again,
so hopefully my
questions will be more clear!
The write command I mean is, - write userid - to display a message
from my terminal to a users terminal.
I am trying to edit the output from this command to display more than
just the text I have typed.
ie. I want to do something simple like display the text to the users
terminal with a border around it.
I can do this with echo... but i'm not sure what file I need to do
this in.
Thanks again,
Ritchie
Dances With Crows <danSPANceswitTRAPhcrows@usa.net> wrote in message news:<slrnc0gvrn.lfe.danSPANceswitTRAPhcrows@saman tha.crow202.dyndns.org>...
- Posted by mj on January 17th, 2004
ritchie wrote:
To display a border on a terminal using actual graphics (instead of
ASCII characters such as | and _) you would have to switch character
sets (look up "CHARACTER SETS" in manual page console_codes), which
involves using escapes and other control characters. This can be done
with echo, but the write command strips off the control characters. If
you were allowed to send control characters to someone else's terminal,
you could do all kinds of things (erasing screen, changing colors etc.)
which the other user might not be entirely happy about. ;-)
- Posted by mj on January 17th, 2004
mj wrote:
Small correction: actually, ctrl-n and ctrl-o are all the control
characters you need to output a border around the text since the VT100
graphics character set is initially loaded into G1. Try this, for example:
echo -e "\016lqqqqqqqqqqqqqqqk\017"
echo -e "\016x\017 Hello, world! \016x\017"
echo -e "\016mqqqqqqqqqqqqqqqj\017"
- Posted by Dances With Crows on January 17th, 2004
On Sat, 17 Jan 2004 18:55:56 +0200, mj staggered into the Black Sun and
said:
Yep. My advice would be to fake it with asterisks and |s and Xs. If
you *really* want to, you could modify /usr/bin/write so that it passes
control characters or outputs "\033[01;41m (bunch of spaces) \033[0m\n"
before and after the message it displays. That may be a long run for a
short slide though, and the control characters won't work on really
broken software like TELNET.EXE.
This doesn't work if the user you're writing to is on an xterm; then you
have to use echo -e "\033(0lqqqk\033(B" AFAICT. Corrections welcome.
--
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin / mail: TRAP + SPAN don't belong
http://www.brainbench.com / Hire me!
-----------------------------/ http://crow202.dyndns.org/~mhgraham/resume
- Posted by mj on January 17th, 2004
Dances With Crows wrote:
I tested 'echo -e "\016lqqqqqqqqqqqqqqqk\017"' in in an XTerm window
under Mandrake 9.1, and it worked. :-)
- Posted by Dances With Crows on January 17th, 2004
On Sat, 17 Jan 2004 21:29:01 +0200, mj staggered into the Black Sun and said:
OK, works in an xterm, doesn't work in konsole. Most of the time,
everything in xterm works in konsole and vice versa--wonder why this
doesn't? Too bad xterm is still using Athena scrollbars; they just don't
react like users expect to button-1 presses.
--
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin / mail: TRAP + SPAN don't belong
http://www.brainbench.com / Hire me!
-----------------------------/ http://crow202.dyndns.org/~mhgraham/resume
- Posted by mj on January 17th, 2004
Dances With Crows wrote:
Some other incompatibilities are listed at
http://dickey.his.com/xterm/xterm.faq.html#bug_konsole
- Posted by Dances With Crows on January 18th, 2004
On Sat, 17 Jan 2004 23:26:37 +0200, mj staggered into the Black Sun and said:
I'm a little suspicious of a page that lists bugs in Konsole 1.0.2
(current 2.5 years ago!) but yeah, the bug you described above is
definitely present. The last bug he lists is not one I can reproduce
though with Konsole 1.2.3/KDE 3.1.5.
I know that xterm is supposed to be basic--but if it had a better UI
(some way to change the font interactively, widget set that works the
way every other widget set does) I think it'd get a lot more use.
--
Matt G|There is no Darkness in Eternity/But only Light too dim for us to see
Brainbench MVP for Linux Admin / mail: TRAP + SPAN don't belong
http://www.brainbench.com / Hire me!
-----------------------------/ http://crow202.dyndns.org/~mhgraham/resume
- Posted by mj on January 19th, 2004
Dances With Crows wrote:
If it's the font size you want to change, it can be done by pressing
Ctrl + right mouse button (in a right-handed mouse) and selecting from
the menu. Other settings are available with Ctrl + left/middle mouse
buttons.
And there's an alternative way to scroll by pressing Shift + Page Up/Down.
- Posted by ritchie on January 23rd, 2004
Hi,
Just wanted to thanks everyone in the group who replied to my post.
Still working on it.
I'll let everybody know if I discover anything with my trying!
Thanks again,
Ritchie
ritchie_s01@yahoo.com (ritchie) wrote in message news:<3bee6ba6.0401161239.20539ea@posting.google.c om>...