6.6. Setting Resources with the -xrm Option
The -xrm command-line option, which is supported by all X Window System clients written with the X Toolkit, can be useful in specifying from the command line any specification that you would otherwise put into a resources file (Section 6.5). For example:
% xterm -xrm 'xterm*Foreground: blue' &
Note that a resource specification on the command line must be quoted using the single quotes.
The -xrm option only specifies the resource(s) for the current instance of the application. Resources specified in this way do not become part of the resource database.
The -xrm option is most useful for setting classes, since most clients have command-line options that correspond to instance variable names. For example, the -fg command-line option sets the foreground attribute of a window, but -xrm must be used to set Foreground.
Note also that a resource specified with the -xrm option will not take effect if a resource that takes precedence has already been loaded with xrdb. For example, say you've loaded a resource file that includes the specification:
The command-line specification of another cursor will fail:
% xterm -xrm '*pointerShape: gumby' &
because the resource xterm*pointerShape is more specific than the resource *pointerShape. Instead, you'll get an xterm with the previously specified pirate cursor.
To override the resource database (and get the Gumby cursor), you'd need to use a resource equally (or more) specific, such as the following:
% xterm -xrm 'xterm*pointerShape: gumby' &
--VQ and SJC
Copyright © 2003 O'Reilly & Associates. All rights reserved.