shell scripting

Short post today. Trying a few things out with QSH and creating shell scripts in the IFS. First of all the shell script needs to reference the correct bin directory as such:


Note there are other script utilities you can reference above like “ksh” and “sh” but if you intend to run CL commands, via the SYSTEM call, then QSH is what you need.

Then you need to make the script executable by running the following.

chmod 755 <>

Now one thing that I was playing with was copying source files on the IFS to native source physical files and doing this from QSH and ultimately via shell scripts. The cp command would not work as the target destination was not recognised as a directory so I reverted back to CL system commands like CPYFRMSTMF and only QSH understands that via the SYSTEM command.


I have done a little more reading and it appears QSH is the old Unix shell type environment that was built using native IBM i objects originally to provide Java a command line environment like all the other implementations. Because of the way it was built it is very comfortable running any SYSTEM commands.

QP2TERM or QP2SHELL is a more recent Unix shell that was ported from the AIX operation system. This is what has underpinned all the recent work to bring in software like PHP and Node.js to the IBM i and should be used to administer that type of programming language.

They are both different flavours of basically the same thing but depending on what you’re trying to do they have their advantages and disadvantages. However if you are looking for a pure shell environment on the IBM i, I think it’s best to install OpenSSH use Putty or similar.