distinguishing virtual consoles

distinguishing virtual consoles

Post by David Boy » Sun, 28 Jun 1992 07:22:41



Does anyone know of a way for a login shell to determine which virtual
console it's running in, so you could put it in your prompt,
for instance?
--

 
 
 

distinguishing virtual consoles

Post by Jim Winstead J » Sun, 28 Jun 1992 09:06:22



>Does anyone know of a way for a login shell to determine which virtual
>console it's running in, so you could put it in your prompt,
>for instance?

Try the 'tty' command, which I believe is part of the GNU shell
utilities, if you don't have it already.

As an example, my prompt looks like the following:

        cerebus:1: /usr/src/linux
        ; _

Cerebus is my hostname (my prompt is the same on my school's computer,
'cept it says jarthur there instead), 1 is the window number (I use
iScreen on the school's computer, so I have window numbers on both
machines), and the directory is the current working directory.

That part of the prompt is all handled by the prompt() function, which
is executed before the prompt is displayed each time.  The hostname
and window number and hostname are figured out on login, and I have
cd/pwd functions to keep the current working directory updated without
running /bin/pwd all the time.

; is then the 'standard' prompt for my shell.

For those that haven't guessed, I'm not using some bloated bohemoth
like bash, tcsh, or even zsh - I'm using rc, an implementation of the
Plan 9 shell.

This goes beyond what you're asking, but I thought others might be
interested to see the sort of thing people might put into their prompt.

Oh, I should also add that the info line of my prompt is in red when
I've su'ed to root, to remind me of the dangers.  :)
--
                                    +    Jim Winstead Jr. (CSci '95)
                                    |            Harvey Mudd College

                                    + This is all my words.  Honest!

 
 
 

distinguishing virtual consoles

Post by Karl R. Bu » Sun, 28 Jun 1992 10:38:12




>>Does anyone know of a way for a login shell to determine which virtual
>>console it's running in, so you could put it in your prompt,
[...]
>Try the 'tty' command, which I believe is part of the GNU shell

[...]
If you are using tcsh just put %l in your prompt command. Here is my
prompt:

set prompt="[%l]%n#"

which gives:

[tty2]kxb>

--
Karl Buck
Grain Marketing                 ---===PEROT FOR PRESIDENT===---
(913)776-2745

 
 
 

distinguishing virtual consoles

Post by Jim Bur » Sun, 28 Jun 1992 16:09:36



Quote:> Does anyone know of a way for a login shell to determine which virtual
> console it's running in, so you could put it in your prompt,
> for instance?

Something like (untested):

tty=`tty`
tty=${tty##tty}

and put $tty in your prompt.
--
BURNS,JIM (returned student)
Georgia Institute of Technology, 30178 Georgia Tech Station,

uucp:     ...!{decvax,hplabs,ncar,purdue,rutgers}!gatech!prism!gt0178a

 
 
 

distinguishing virtual consoles

Post by Kevin Bro » Sun, 28 Jun 1992 20:53:52



[...]

Quote:>Oh, I should also add that the info line of my prompt is in red when
>I've su'ed to root, to remind me of the dangers.  :)

As if the '#' isn't enough.  :-)

Once you get used to the red, though, you'll clearly have to get it to
blink!  :-)

Quote:>                                    +    Jim Winstead Jr. (CSci '95)

--

 
 
 

1. creating a new virtual console alongside existing vt100 consoles

Hello,
For my own amusement I am interested in creating a special
console that will use the F12 key. Does anyone know
if it is possible to have the existing Linux consoles
coexisting with the new one? Or would I have to modify the
existing VT100 console? What I want to do is radically
different from a VT100 emulation.
Thanks.

2. New k6-2 system advice

3. is a virtual console truly virtual?

4. "The Linux Store"'s N-Flux

5. Second virtual console missing in SuSE-installation

6. RPM Problem?????????

7. unblank syslog virtual console

8. Adding a Printer (Error)

9. more virtual consoles !! :)

10. changing to another virtual console...

11. Virtual consoles and X

12. XDM and Virtual Consoles...

13. Virtual consoles on solaris 7?