Irssi settings and Bash's Environment variables

6

1

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

user3672

Posted 2009-09-26T21:21:05.170

Reputation:

Keep in mind that after successfully updating this, you need to /disconnect and reconnect, before they'll update. – isomorphismes – 2014-11-05T22:41:39.803

Answers

2

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?

Paused until further notice.

Posted 2009-09-26T21:21:05.170

Reputation: 86 075

1

From https://github.com/irssi/irssi/blob/master/docs/special_vars.txt, it appears that env vars are made available as variables in the config

– Dmitry Minkovsky – 2014-10-05T18:26:59.810

4I'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? – Thomas Schreiber – 2011-04-18T10:31:43.720

3

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.

user1686

Posted 2009-09-26T21:21:05.170

Reputation: 283 655

1I'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? – Thomas Schreiber – 2011-04-18T10:32:36.077

@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.

– user1686 – 2011-04-18T11:24:06.163

@rizumu: However, next time you have questions not directly related to my answer, please submit them as a separate post, not as a comment.

– user1686 – 2011-04-18T11:24:58.910

@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. – user1686 – 2011-04-18T11:26:55.303

1I 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. – Thomas Schreiber – 2011-05-31T19:47:12.043

When I type \set real_name isomorphismes it doesn't change the output of \whois mynicknameonfreenode. – isomorphismes – 2014-05-29T21:08:42.330

1@isomorphismes: This information is sent only once when connecting; it cannot be updated in the middle of connection. (Also, it is /set and /whois.) – user1686 – 2014-05-30T06:07:52.577

1

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.

user7385

Posted 2009-09-26T21:21:05.170

Reputation:

0

You can automatically IDENTIFY in Irssi from a password stored in your ~/.bashrc file. Irssi allows the use of environment variables in its config file, (in much the same way that you would use them in any bash script).

First export your password.

~/.bashrc

export FREENODE_PASSWORD='your_password'

Then run IDENTIFY with the autosendcmd inside of chatnets. Make sure you add a wait period to the beginning of the command to make sure it runs after the server is ready.

~/.irssi/config

chatnets = {
  Freenode = {
    type = "IRC";
    nick = "your_nick";
    autosendcmd = "wait 2000; /msg NickServ IDENTIFY $FREENODE_PASSWORD";
  }
}

f1lt3r

Posted 2009-09-26T21:21:05.170

Reputation: 133

For anybody here thinking that you can use env variables elsewhere in the config: turns out, you cannot. This means you can't use them in sasl_password or other config settings in particular. The functionality that handles these "expandos" only runs for the autosendcmd and commands run when irssi is open.

– diurnalist – 2020-02-19T23:01:53.183

0

Try the following:

sudo gedit ~/.irssi/config

weev_is_a_fag

Posted 2009-09-26T21:21:05.170

Reputation: 11