OS/2 tricks: How to run foreign shell scripts
Generally, what to do in order to run foreign shell scripts is to run shell scripts with a shell script processor. For examples, if you want to run a shell script, test.sh for sh, then you should do
But OS/2 provides a special keyword to ease this. That is extproc. By default OS/2 has two script processorst. One is a batch processor, the other one is REXX. However, with extproc, OS/2 can process other scripts than a batch and a REXX. extproc is similar to #! of Unix worlds. If the first line of a script file is extproc, then the remaining parts are treated as an script processors. Notice that scripts files should have .cmd extension.
For examples, the above command can be written like this,
shtest.cmd
-----
extproc sh
...
orignal stuffs of test.sh
...
-----
Then, you can excute shtest.cmd directly with OS/2 command processors such as CMD.EXE or 4OS2.EXE.
In pratice, shtest.cmd is executed like this by OS/2,
Sometimes, extproc is not supported by foreign shell script processors. In those cases, they warn about extproc. But shell scripts itself is executed as expected.
If you want to run perl scripts, then put extproc perl at the first line. And you can append parameters to processors.
For example, provided that the first line is [extproc exsh -e] of shtext.cmd, and execute [shtest hello], then it is executed as [exsh -e shtest.cmd hello]
- sh shtest.sh
But OS/2 provides a special keyword to ease this. That is extproc. By default OS/2 has two script processorst. One is a batch processor, the other one is REXX. However, with extproc, OS/2 can process other scripts than a batch and a REXX. extproc is similar to #! of Unix worlds. If the first line of a script file is extproc, then the remaining parts are treated as an script processors. Notice that scripts files should have .cmd extension.
For examples, the above command can be written like this,
shtest.cmd
-----
extproc sh
...
orignal stuffs of test.sh
...
-----
Then, you can excute shtest.cmd directly with OS/2 command processors such as CMD.EXE or 4OS2.EXE.
In pratice, shtest.cmd is executed like this by OS/2,
- sh shtest.cmd
Sometimes, extproc is not supported by foreign shell script processors. In those cases, they warn about extproc. But shell scripts itself is executed as expected.
If you want to run perl scripts, then put extproc perl at the first line. And you can append parameters to processors.
For example, provided that the first line is [extproc exsh -e] of shtext.cmd, and execute [shtest hello], then it is executed as [exsh -e shtest.cmd hello]
댓글
댓글 쓰기