Troubleshooting
Problem
This document will cover what the PATH environment variable and the Current Working Directory concepts mean, the different ways the current working directory can be included in the PATH environment variable, and its effect in the Qshell environment.
Resolving The Problem
Current Working Directory
Within the Qshell Interpreter environment, commands that you type are executed in terms of your current working directory. You could say the current working directory is the directory in which you are currently located or reside in. Whenever you start a new Qshell Interpreter session, your current working directory is set to your home directory by default, for example, /home/user.
PATH Environment Variable
The PATH environment variable is a colon delimited list of directories that tells Qshell where to find commands. The default value is PATH=/usr/bin:
When a command is not fully qualified at execution time, a list of directories to search for the command is retrieved from the PATH variable.
If the PATH variable is set to /usr/bin:/QOpenSys/usr/bin:
Qshell first looks for the command in the /usr/bin directory, then in the QOpenSys/usr/bin directory, and finally in the current working directory. When the PATH variable begins or ends with a colon or contains two adjacent colons, qshell searches in the current working directory. A period can also be used to signify the current working directory. The period can be located anywhere in the PATH variable as shown in the examples below.
Examples when the current working directory would be searched:
::/usr/bin:/QOpenSys/usr/bin - double colon at the beginning
/usr/bin::/QOpenSys/usr/bin - double colon in the middle
/usr/bin:/QOpenSys/usr/bin:: - double colon at the end
:/usr/bin:/QOpenSys/usr/bin - colon is located at the beginning
/usr/bin:/QOpenSys/usr/bin: - colon is located at the end
.:/usr/bin:/QOpenSys/usr/bin - period is used at the beginning
/usr/bin:.:/QOpenSys/usr/bin - period is used in the middle
/usr/bin:/QOpenSys/usr/bin:. - period is used at the end
Examples when the current working directory would not be searched:
/usr/bin:/QOpenSys/usr/bin - no colon at the beginning or end, no period, and no double colon
Effects in Qshell
Let's say the command you want to execute resides in the current working directory. In this case, your current working directory is "/home/user". The PATH variable is currently set to "/usr/bin:/QOpenSys/usr/bin". Finally, the command you are executing is "qshell_script.sh".
At the Qshell Interpreter command line, enter qshell_script.sh and press Enter. Because the currently working directory is not included in the PATH variable, the following message is returned to standard output:
qsh: 001-0019 Error found searching for command <command>. No such path or directory.
In our case, the exact message would be as follows:
qsh: 001-0019 Error found searching for command qshell_script.sh. No such path or directory.
Within the Qshell Interpreter environment, commands that you type are executed in terms of your current working directory. You could say the current working directory is the directory in which you are currently located or reside in. Whenever you start a new Qshell Interpreter session, your current working directory is set to your home directory by default, for example, /home/user.
PATH Environment Variable
The PATH environment variable is a colon delimited list of directories that tells Qshell where to find commands. The default value is PATH=/usr/bin:
When a command is not fully qualified at execution time, a list of directories to search for the command is retrieved from the PATH variable.
If the PATH variable is set to /usr/bin:/QOpenSys/usr/bin:
Qshell first looks for the command in the /usr/bin directory, then in the QOpenSys/usr/bin directory, and finally in the current working directory. When the PATH variable begins or ends with a colon or contains two adjacent colons, qshell searches in the current working directory. A period can also be used to signify the current working directory. The period can be located anywhere in the PATH variable as shown in the examples below.
Examples when the current working directory would be searched:
::/usr/bin:/QOpenSys/usr/bin - double colon at the beginning
/usr/bin::/QOpenSys/usr/bin - double colon in the middle
/usr/bin:/QOpenSys/usr/bin:: - double colon at the end
:/usr/bin:/QOpenSys/usr/bin - colon is located at the beginning
/usr/bin:/QOpenSys/usr/bin: - colon is located at the end
.:/usr/bin:/QOpenSys/usr/bin - period is used at the beginning
/usr/bin:.:/QOpenSys/usr/bin - period is used in the middle
/usr/bin:/QOpenSys/usr/bin:. - period is used at the end
Examples when the current working directory would not be searched:
/usr/bin:/QOpenSys/usr/bin - no colon at the beginning or end, no period, and no double colon
Effects in Qshell
Let's say the command you want to execute resides in the current working directory. In this case, your current working directory is "/home/user". The PATH variable is currently set to "/usr/bin:/QOpenSys/usr/bin". Finally, the command you are executing is "qshell_script.sh".
At the Qshell Interpreter command line, enter qshell_script.sh and press Enter. Because the currently working directory is not included in the PATH variable, the following message is returned to standard output:
qsh: 001-0019 Error found searching for command <command>. No such path or directory.
In our case, the exact message would be as follows:
qsh: 001-0019 Error found searching for command qshell_script.sh. No such path or directory.
[{"Type":"MASTER","Line of Business":{"code":"LOB68","label":"Power HW"},"Business Unit":{"code":"BU070","label":"IBM Infrastructure"},"Product":{"code":"SWG60","label":"IBM i"},"ARM Category":[{"code":"a8m0z0000000CHQAA2","label":"Qshell"}],"ARM Case Number":"","Platform":[{"code":"PF012","label":"IBM i"}],"Version":"All Versions"}]
Historical Number
489394362
Was this topic helpful?
Document Information
Modified date:
14 November 2024
UID
nas8N1013630