![]() |
![]() |
![]() |
![]() |
6 PECS (Pluggable Environment Contribution System)
6.1 A CRASH-COURSE IN BOURNE SHELL
What follows is a little cookbook of common things you may wish to put in your ~/.pecs/*.env files:
(Notice there are no spaces around the '='; bourne shell is sensitive
To safely test if a variable is set do this:
if [ "X$VARIABLE" != X ]; then
code to do if VARIABLE is not set
To set an alias, put something like this in your
A switch statement looks like this:
*) this is the default action ;;
If you want to do a tcsh rehash, you should do:
6.2 USER ENVIRONMENT SETTINGS
PECS supports personal settings for the following types of settings:
All personal settings belong in files in the ~/.pecs directory, which should exist and contain (comments-only) example files. The big problem with putting a setting in one of these files, is knowing which file to put it in! This section explains the steps to determine where to put a setting:
Four 'types' of personal settings are supported by PECS:
If the setting you wish to make is one of the above types, then you should note down what 'type' it is.
If the setting you want to make is not one of these then it is a setting outside the scope of PECS and you should make the setting in another way.
This may mean that you put the setting in a file where the program will look (e.g. putting settings for FTP in ~/.netrc) or it may mean that you put the setting in a file in which the program will check due to locally modified behaviour (e.g. personal emacs settings go ~/.emacs.local).
Consult your application or system adminstrators if you are unsure how to do this.
(e.g. DFLOW_ROOT because it relates to older versions of VLTSW only, NNTPSERVER, LESS, MAIL, PATH=$HOME/bin:$PATH).
4) Put the setting in the right file
Now that you've worked out the three attributes 'type', 'application-scope' and 'host-scope', it's easy; the setting belongs in the file:
~/.pecs/<application-scope>-<host-scope>.<type>
e.g., to change your prompt set 'PS1' in ~/.pecs/apps-all.env, and
to change your VLTROOT set VLTROOT in the same file.
To activate the change in setting first run:
Let's look at a couple of examples; consider each of the following
settings, look at the values it has for each attribute, and see the
Suppose you're working on a machine where VLTROOT is set to /vlt/MAR2001/CCS, and you need to point it at FEB2000 instead just for a quick test. Well,
it's an environment variable (type=env)
it relates to VLTSW, which is a PECS-aware application (application-scope=apps)
you only need it for a quick test on host 'te13' (host-scope=te13)
So, having worked that out, the setting belongs in the file:
Note that environment variables supported by a PECS-aware application are automatically made available to sub-processes ('exported') so you do not need to export it yourself (though it does no harm to do so).
Yes, the 'which' command under Bourne-like shells does not work quite the same as it did under Tcsh. Under Bash, the nearest equivalent to 'which' is 'type' or 'type -all'. So to make 'which' an alias for 'type -all':
it's not related to a PECS-aware application, it's just personal setting (application-scope=misc)
you want it everywhere (host-scope=all)
So, having worked that out, the setting belongs in the file:
Aliases are read per-shell-process, so it is not necessary to log out; your next new xterm will see the alias.
Note that Bash aliases have an '=' between the alias and its value, unlike Tcsh.
Example #3: you want to add 'top' and 'xv' to your 'User Menu'
PECS provides a GUI root window sub-menu entitled 'User Menu'. Suppose you want to create the menu to contain the command
it's a GUI root window menu item (type=wmrc)
it's not related to a PECS-aware application (the user menu never is) (application-scope=misc)
you want to see this menu everywhere (host-scope=all)
So, having worked that out, the setting belongs in the file:
"Top" f.exec "xterm -T top -n top -e top"
Note that 'top' isn't on all systems, so simply calling 'top' is a bit naive.
To activate the settings select 'Restart' from the GUI root window menu.
Example #4: you don't like the Xclock updating every second
PECS allows you to specify new values for X resources, but it also allows you to 'unset' existing ones (this is not a standard behaviour of X).
You will probably find your Xclocks showing a second hand, because of the X resource:
To cancel this setting, just provide a blank value for it. So,
it's an X resource (type=xrdb)
it's related to a PECS-aware application (yes, this resource is defined by VLTSW)
you want to see this menu everywhere (host-scope=all)
So, having worked that out, the setting belongs in the file:
To activate the change you need to log out and log in again.
Example #5: you don't like to use
Very bad idea, but if you are so obstinate, you should write a function, because aliases which require embedded parameters must be written as functions, but should still be put in the ".ali" file. Here's an example:
![]() Quadralay Corporation http://www.webworks.com Voice: (512) 719-3399 Fax: (512) 719-3606 sales@webworks.com |
![]() |
![]() |
![]() |
![]() |