Username Password
Bookmark and Share

The WRE and your shell environment


This article describes how to avoid polluting your shell environment with

Background Story

Traditionally, people type the following incantation in their shell before interacting with the WRE:

. /data/wre/sbin/ 

This sets your PATH, PERL5LIB, LD_LIBRARY_PATH and other associated shell environment variables to work with the WRE. Some people go so far as to put the above line into their .bashrc (or equivalent) so that the environment is modified automatically for every new shell.

The downside to this is that after running this command, you really shouldn't use this shell for anything except WRE-related tasks. The changes to PATH, LD_LIBRARY_PATH, etc.. can cause strange things to happen: warnings about incompatible libraries, programs refusing to run, files installed into the wrong place, etc..


Instead of sourcing into your current shell, you can keep your environment clean by using a small wrapper script that launches a sub-shell every time you want to interact with the WRE.

Create the following file, save it as /data/wre/sbin/ and chmod +x it:

. /data/wre/sbin/
exec "$@"

Next, create the following aliases by adding the following lines to your .bashrc (or equivalent)

alias wre='/data/wre/sbin/'
alias sudowre='sudo /data/wre/sbin/'
alias wreconsole='sudowre /data/wre/sbin/'
alias wreservice='sudowre /data/wre/sbin/'

You can now run individual commands in the WRE environment without polluting your current shell environment, simply by adding "wre" to the start of your command, e.g.

wre which perl # /data/wre/prereqs/bin/perl
wre mysql -uroot -p123qwe # connects to db via WRE's mysql client
wre /data/WebGUI/sbin/ # test your WRE environment
wre cpan # install CPAN modules into the WRE

The sudowre alias works the same, except it runs the command as root.

The wreconsole and wreservice aliases are handy shortcuts for accessing there WRE scripts. e.g.

wreservice --restart web

Other Things

Of course, after you install WGDev you'll probably find yourself typing "wgd <command>" far more frequently than "wre <command>", but it's nice to have it there when you need it.

One scenario where you will typically still want to use the wre command is for installing CPAN modules into your WRE (at least until someone writes a wgd plugin for it..). You may find the local::lib wiki article useful for learning how to manage your WRE CPAN modules.

Keywords: WRE

Search | Most Popular | Recent Changes | Wiki Home
© 2018 Plain Black Corporation | All Rights Reserved