up vote 2 down vote favorite
share [g+] share [fb]

How can I define settings, such as ircname, nick and such things, in .bashrc for Irssi?

link|improve this question
feedback

migrated from stackoverflow.com Sep 27 '09 at 1:15

This question came from our site for professional and enthusiast programmers.

3 Answers

up vote 1 down vote accepted

The settings for Irssi go in ~/.irssi/config.

However, in general, any Bash environment variable is set in ~/.bashrc like this:

export varname=value

The real question is how do you get Irssi to use those variables?

link|improve this answer
I'd like to keep my freenode password in an environment variable or external file, so I can keep my irssi config in a public dotfiles repository. Any suggestions? – rizumu Apr 18 '11 at 10:31
feedback

While I can imagine setting alias like:

alias irssi="irssi -c some.server -n your_nick"

it doesn't make sense. Irssi is very configurable, and it has a proper config file, so why don't you use it?

For example:

Start irssi, issue /network add; /server add; /channel add commands - best if you'd set the server and channel to auto-connect and autojoin.

Then, do /save, and quit irssi.

And then restart irssi, and voila - it will autoconnect everywhere you configured it to.

If you'll have any problems, just consult docs.

link|improve this answer
feedback

A much better way would be to set all these settings to your irssi config file. For example, this command will change the nickname:

/set nick Heoa

And every time you start irssi, this nickname will be used.


If you still want it - irssi supports these environment variables:

  • IRCNICK - nick
  • IRCNAME - real_name (the ircname line in /whois output)
  • IRCUSER - user_name (also called ident)
  • IRCHOST - hostname (you will probably never use this one)

Note that these environment variables are only set on the first run, and they are ignored if ~/.irssi/config exists.

link|improve this answer
I'd like to keep my freenode password in an environment variable or external file, so I can keep my irssi config in a public dotfiles repository. Any suggestions? – rizumu Apr 18 '11 at 10:32
@rizumu: Passwords in environment variables are a stupid idea, because every program would get a copy of it without even asking. As for external file... As for external files, you can have this on Freenode - by using a SASL authentication script. SASL is the preferred way of authentication on IRC. – grawity Apr 18 '11 at 11:24
@rizumu: However, next time you have questions not directly related to my answer, please submit them as a separate post, not as a comment. – grawity Apr 18 '11 at 11:24
@rizumu: ...also, for SASL-incapable networks, I used to have a script that would grab the server password from a file. I'll try to find it. – grawity Apr 18 '11 at 11:26
I now realize this should have been a separate question, but all searching led me here and it seemed related enough at the time. Well thanks for the tip. – rizumu May 31 '11 at 19:47
feedback

Your Answer

 
or
required, but never shown