Sign in

docs Open Source

Adjusting your PATH temporarily

Adjusting your PATH temporarily

Temporarily adjust your path by running the following two commands:

PATH=/QOpenSys/pkgs/bin:$PATH
export PATH

After that, typing commands should find RPM-installed open source tools (if using bash already, you may need to run hash -r, like the following example

$ bash --version
GNU bash, version 4.4.12(1)-release (powerpc-ibm-os400)
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

If you want to make your PATH setting permanent, add the above line to your $HOME/.profile and/or your $HOME/.bash_profile (if you are using bash). You can do this easily (from a shell) like so.

touch $HOME/.profile
setccsid 1208 $HOME/.profile
echo 'PATH=/QOpenSys/pkgs/bin:$PATH' >> $HOME/.profile
echo 'export PATH' >> $HOME/.profile

To make this change for all users, put these lines in /QOpenSys/etc/profile.local, like so:

touch /QOpenSys/etc/profile.local
setccsid 1208 /QOpenSys/etc/profile.local
echo 'PATH=/QOpenSys/pkgs/bin:$PATH' >> /QOpenSys/etc/profile.local
echo 'export PATH' >> /QOpenSys/etc/profile.local

Another way to make this change for all users that will also affect PASE programs called directly via QP2SHELL is to add the PASE_PATH environment variable at *SYS level. You may want to do this in addition to the above, make sure to test all your use cases (eg. QP2TERM, QP2SHELL, and SSH) to ensure the path is as desired. Run this as a *SECOFR class user:

ADDENVVAR ENVVAR(PASE_PATH) VALUE('/QOpenSys/pkgs/bin:/QOpenSys/usr/bin:/usr/ccs/bin:/QOpenSys/usr/bin/X11:/usr/sbin:.:/usr/bin') LEVEL(*SYS)

Need to run globally-installed Node.js modules, or choose a Node.js version on a per-user basis?

To run node-gyp or other globally-installed modules, or to switch the default version of Node.js for a specific user, place /QOpenSys/pkgs/lib/nodejs<version>/bin at the beginning of the user’s PATH environment variable. For instance, that user could run the following from the shell to set their default to version 10:

touch $HOME/.profile
setccsid 1208 $HOME/.profile
echo 'PATH=/QOpenSys/pkgs/lib/nodejs10/bin:/QOpenSys/pkgs/bin:$PATH' >> $HOME/.profile
echo 'export PATH' >> $HOME/.profile

(if using bash as the shell, the user may need to run hash -r)

Verifying that your PATH is set correctly

Simply run the following from your operating environment:

echo $PATH

The output should be a :-delimited list of directories. These will be searched, in order, for any commands entered into your shell. The PATH should contain, at minimum, /QOpenSys/pkgs/bin, very preferrably before the “standard” paths like /QOpenSys/usr/bin or /usr/bin. You may also see other PATHS you added to the beginning, for instance, to choose a Node.js version per the Node.js usage notes

For example: Horrible

/usr/bin:.:/QOpenSys/usr/bin

Bad

/QOpenSys/usr/bin:/usr/ccs/bin:/QOpenSys/usr/bin/X11:/usr/sbin:.:/usr/bin

Marginal

/QOpenSys/usr/bin:/usr/ccs/bin:/QOpenSys/usr/bin/X11:/usr/sbin:.:/usr/bin:/QOpenSys/pkgs/bin

Best

/QOpenSys/pkgs/bin:/QOpenSys/usr/bin:/usr/ccs/bin:/QOpenSys/usr/bin/X11:/usr/sbin:.:/usr/bin