You are not logged in.

#1 2004-03-07 18:08:43

punkrockguy318
Member
From: New Jersey
Registered: 2004-02-15
Posts: 711
Website

Login scripts?

Where can I find login scripts?  Like commands executed when login (ie like getting fortune to display on login)


If I have the gift of prophecy and can fathom all mysteries and all knowledge, and if I have a faith that can move mountains, but have not love, I am nothing.   1 Corinthians 13:2

Offline

#2 2004-03-07 18:16:01

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,378
Website

Re: Login scripts?

punkrockguy318 wrote:

Where can I find login scripts?  Like commands executed when login (ie like getting fortune to display on login)

/home/yourUser/.bashrc

is run every time you login a console or xterm

simply add as last line "fortune" and it will give you a fortune every login :-)

or if you want something more nice:

install "cowsay" pkg (pacman -Sy cowsay) and then add this line ... looks really nice :-)

fortune -s | cowsay -f tux

The impossible missions are the only ones which succeed.

Offline

#3 2004-03-07 18:17:50

punkrockguy318
Member
From: New Jersey
Registered: 2004-02-15
Posts: 711
Website

Re: Login scripts?

also:  how can I change the prompt?
[name@arch /]$  the colors and stuff?


If I have the gift of prophecy and can fathom all mysteries and all knowledge, and if I have a faith that can move mountains, but have not love, I am nothing.   1 Corinthians 13:2

Offline

#4 2004-03-07 18:18:51

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,378
Website

Re: Login scripts?

the output would look like this:

 ______________________________________ 
/ Murphy's Law of Research:            
|                                      |
| Enough research will tend to support |
 your theory.                         /
 -------------------------------------- 
   
    
        .--.
       |o_o |
       |:_/ |
      //    
     (|     | )
    /'_   _/`
    ___)=(___/

The impossible missions are the only ones which succeed.

Offline

#5 2004-03-07 18:20:12

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,378
Website

Re: Login scripts?

punkrockguy318 wrote:

also:  how can I change the prompt?
[name@arch /]$  the colors and stuff?

also in this file:

PS1='[u@h W]$ '

is the prompt


The impossible missions are the only ones which succeed.

Offline

#6 2004-03-07 18:21:14

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,378
Website

Re: Login scripts?


The impossible missions are the only ones which succeed.

Offline

#7 2004-03-07 18:23:57

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,378
Website

Re: Login scripts?

the color codes are the same as for /etc/issue or any console-color thing ... have a look at
http://daperi.home.solnet.ch/linux/arch/index.html
in the middle of the page the 2 tables for all codes available for coloring

the syntacs is easy:

no color ... 33[01;31m this text should be in color 31 and style 01 33[0m and now again reset to no color, style 0

note that 33 means the same as the "escape"-character in issue i mentioned on my site


The impossible missions are the only ones which succeed.

Offline

#8 2004-03-07 19:24:30

punkrockguy318
Member
From: New Jersey
Registered: 2004-02-15
Posts: 711
Website

Re: Login scripts?

Wow!  Thanks a lot! big_smile  big_smile I love how you guys always help, and fast replies too! lol  lol


If I have the gift of prophecy and can fathom all mysteries and all knowledge, and if I have a faith that can move mountains, but have not love, I am nothing.   1 Corinthians 13:2

Offline

#9 2004-03-07 22:10:08

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,378
Website

Re: Login scripts?

you're welcome ...
by the way: how did you set your prompt? may i ask for your new PS1 ? :-)

here another nice example i use on my machine:

PS1='33[34;01mu33[34;0m@33[31;0mh:l33[34;01m[W]33[32;01m#:33[00;01m'

u = user
h = hostname
l = consolenumber
W = path (last)
# = command-number in this console (very usefull, if you want to quote the output and speak about it)

(EDITED: changed the code-format to 33[${color};${style}m)


The impossible missions are the only ones which succeed.

Offline

#10 2004-03-07 22:26:45

punkrockguy318
Member
From: New Jersey
Registered: 2004-02-15
Posts: 711
Website

Re: Login scripts?

user:

PS1='{33[00;34mu33[0m@h W}$ '

root:

PS1='[33[0;31mu33[0m@h W]$ '

I'll add more later!


If I have the gift of prophecy and can fathom all mysteries and all knowledge, and if I have a faith that can move mountains, but have not love, I am nothing.   1 Corinthians 13:2

Offline

#11 2004-03-07 23:10:41

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,378
Website

Re: Login scripts?

... with style "5" you can make the prompt blinking :-) ... can be fun for root having something like

PS1='[33[5;31mu33[0m@h W]$ '

(but this is really playing around ... nothing to do with "ergonomics at work" wink )


The impossible missions are the only ones which succeed.

Offline

#12 2004-03-08 01:33:53

punkrockguy318
Member
From: New Jersey
Registered: 2004-02-15
Posts: 711
Website

Re: Login scripts?

dp wrote:

... with style "5" you can make the prompt blinking :-) ... can be fun for root having something like

PS1='[33[5;31mu33[0m@h W]$ '

(but this is really playing around ... nothing to do with "ergonomics at work" wink )

Hmm.. the 5 only gives it a gray bg... Any ideas?


If I have the gift of prophecy and can fathom all mysteries and all knowledge, and if I have a faith that can move mountains, but have not love, I am nothing.   1 Corinthians 13:2

Offline

#13 2004-03-08 06:35:16

dp
Member
From: Zürich, Switzerland
Registered: 2003-05-27
Posts: 3,378
Website

Re: Login scripts?

punkrockguy318 wrote:
dp wrote:

... with style "5" you can make the prompt blinking :-) ... can be fun for root having something like

PS1='[33[5;31mu33[0m@h W]$ '

(but this is really playing around ... nothing to do with "ergonomics at work" wink )

Hmm.. the 5 only gives it a gray bg... Any ideas?

hmm ... maybe 33[31;05m ? (sorry, just edited your line directly) ... it's always a good idea to specify first the color and then the style and to give the leading 0 for the style code wink

.. the other thing with blinking is that it works only on some consoles (in the VC but not with all framebuffers and also not with xterm but works fine in konsole)


The impossible missions are the only ones which succeed.

Offline

#14 2004-03-08 13:58:49

slyski
Member
From: Cheese Head Land
Registered: 2004-01-11
Posts: 60

Re: Login scripts?

if you are talking about the console colors themselves and not just the prompt take a look at setterm

type setterm at the prompt for list of options
there is a man page also on it

slyski


Joey: If a cow passes away from natural causes can I eat it.
Pheobe: Not if I get there first.

Offline

#15 2004-07-27 19:08:36

hypermegachi
Member
Registered: 2004-07-25
Posts: 311

Re: Login scripts?

is there a way to randomize which cow is talking?

Offline

#16 2004-07-27 21:12:47

farphel
Forum Fellow
From: New Hampshire - USA
Registered: 2003-09-18
Posts: 250
Website

Re: Login scripts?

Ok... So I was bored...

Add this to your .bashrc to get the random cow file and fortune output.

function randcowfile() {
  # where do the cow files live?
  #
  COWFILES='/usr/share/cows'

  file_list=(`ls -l $COWFILES | awk '{ print $9 }'`)
  num_files=`expr ${#file_list[@]} + 1`
  randex=`expr $RANDOM / ( 32768 / $num_files )`
  cowfile=`basename ${file_list[$randex]} .cow`
  echo $cowfile
}

fortune -s | cowsay -f `randcowfile`

Follow the link below, sign up, and accept one promotional offer.  If I can get five suckers (err... friends) to do this, I'll get a free iPod.  Then you too can try to get a free iPod. Thanks! http://www.freeiPods.com/?r=11363142

Offline

#17 2004-07-27 22:08:17

hypermegachi
Member
Registered: 2004-07-25
Posts: 311

Re: Login scripts?

thanks!  works like a charm.

Offline

Board footer

Powered by FluxBB