If you're like I am you may have struggled a little when starting to use PASE and open source packages for your IBM i application development or operations.
The open source packages are usually installed in a directory named: /QOpenSys/pkgs/bin
For example the first thing you may have run into when trying to call a git command from a QShell or PASE session might have been: git: command not found.
You development or operations leaders told you to use git, but it's not running for you. And you don't want to look dumb asking why the git command won't run.
Well just like we have library lists for classic IBM i jobs, PASE jobs and command lines use a directory search path which is the PASE equivalent to the library list.
If you run the following commands from a QShell, PASE or SSH terminal session you should be all set to start using open source command line apps because the commands create a profile file including a search path for QShell and other PASE apps if you happen to be using bash instead of QShell.
To run these PASE profile creation commands you should be able to run STRQSH from a 5250 command line.
First make sure your user profile has a home directory. This same value must also be set in the user profile Home Directory setting if you do a WRKUSRPRF or DSPUSRPRF on your user profile.
mkdir /HOME/RICHARD.
Note: If your home directory gets created or already exists you're in good shape either way.
Then type and run each of the following individual commands.
What they will do:
The rm command first deletes the profile file if it exists.
Note: If you get an error that file does not exist, that should be OK just continue to the next command.
The touch command creates an empty profile file with CCSID 819 which is ASCII. This will make sure that QShell write ASCII data to your profile files.
The echo command writes the desired open source search path and appends the existing search path to it using the $PATH directive.
Let's create the profiles now.
WARNING: If you already have bash or QShell profile files you may not want to run these commands as they overwrite those profile files. Or make backups of the files beforehand. If you want to just edit your existing profile files, you might need to edit the file with the EDTF command from 5250 or vim or nano from the PASE command line instead and simply add the path statement.
Create a QShell profile
rm ~/.profile
touch -C 819 ~/.profile
echo PATH=/QOpenSys/pkgs/bin:$PATH > ~/.profile
Create bash profiles
rm ~/.bashrc
touch -C 819 ~/.bashrc
echo export PATH=/QOpenSys/pkgs/bin:$PATH > ~/.bashrc
rm ~/.bash_profile
touch -C 819 ~/.bash_profile
echo export PATH=/QOpenSys/pkgs/bin:$PATH > ~/.bash_profile
After you've created these profile files, you should be able to access any of the IBM i open source packages from any of the command line shells, QShell, PASE (CALL QP2TERM) or bash command lines in an SSH terminal client.
Simply exit and restart your favorite PASE command line shell, type git (or whatever other command you were trying to access) and it should show work as expected.
If you happen to be using my QShell on i utilities to run PASE commands the path handling is done automatically when you run a command. Check them out at: https://github.com/richardschoen/QshOni
No comments:
Post a Comment