skip navigation

This page looks better in modern browsers. Please upgrade.

Brown Home Brown Home Brown Home Brown CS

Setting Your PRINTER Environment Variable

On UNIX and Linux systems, most applications will direct print jobs to the printer defined by your PRINTER environment variable. How and where you set this depends upon which desktop environment you use.

XSession

Your X session is usually defined in your .xsession file. Because it is a shell script, it inherits any environment variables that you have set.

Gotcha!

However, if your .xsession file uses a different shell than you normally use, it will not inherit anything. In the most common case, you set your PRINTER variable in your .cshrc file, but your .xsession file is a Bourne shell script (sh). You can tell what kind of shell your .xsession file uses by inspecting the first line, which begins with "#!".

What to do

You have two choices: convert your .xsession file to csh syntax, or define your PRINTER variable for Bourne shells.

Converting your .xsession file is not hard, and is the best solution. It does require some expertise, however. The technical staff will convert your .xsession file by request, just mail "problem."

Alternatively, you can set your PRINTER variable in a .profile file, using sh syntax. For example:

PRINTER=myprinter
export PRINTER

Gnome

Gnome will most likely ignore the PRINTER environment variable setting in your .cshrc, since it is launched before you have any shells running.

Tell Gnome about your printer by creating a .gnomerc file, and put something like the following in it:

PRINTER=myprinter
export PRINTER

KDE

KDE will most likely ignore the PRINTER environment variable setting in your .cshrc, since it too is launched before you have any shells running.

However, we are not sure what is the best way for KDE users to set their default printer. We'd like to hear from any KDE users who either have a problem with this, or a solution.

Mail "problem."


Page Owner: Kathy Kirman Last Modified: Fri Apr 15 11:07:44 2005