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
command. For example, if you want anyone to be able to run your script, type:
chmod a+x script_name
Your script doesn't have to be executable if you plan to invoke it by passing it as a shell argument:
or if you use it as a dot file, like this:
- 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:
- When you run a script, it inherits its environment from the parent process. If your script executes a command that might not be in the 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. If you edit a Neutrino script on a Windows machine, use the textto utility with the -l option to convert the file to the format used by the QNX 4 filesystem.