Caveat scriptor
QNX SDP8.0User's GuideUser
If you need to write shell scripts, there are a few things to bear in mind.
- In order to run a script as if it were a utility, you must make it executable by using the
chmod
command. For example, if you want anyone to be able to run your script, type:
Your script doesn't have to be executable if you plan to invoke it by passing it as a shell argument:chmod a+x script_name
or if you use it as aksh script_name
dot file,
like this:. script_name
- Just as for any executable, if your script isn't in one of the directories in your
PATH, you have to specify the path to the script in order to run it.
For example:
~/bin/my_script
- When you run a script, it inherits its environment from the parent process. If your script executes a command that might not be found in PATH, you should either specify the path to the command or add the path to the script's PATH variable.
- A script can't change its parent shell's environment or current directory, unless you run it as a dot file.
- A script won't run if it contains DOS end-of-line characters (\r\n).
If you edit a QNX OS script on a Windows machine,
you must save it in a format that uses UNIX newline separators (\n)
because this is the format used by the QNX OS.
The QNX Momentics IDE has a feature for doing so;
for more information, see the
Target File System Navigator
topic in the IDE User's Guide.
Page updated: