Home Corporate Contacts TETware Knowledgebase |
ProductsSolutionsInformationDatasheetDocumentationFAQKnowledgebase |
Return to Knowledgebase Index21. Porting Korn Shell arithmetic expressions from UNIX to Win32 systems
Question I have ported a Korn Shell test case from a UNIX system to a Win32 system. When I run the test case it prints the following message: i+=4: tp4: d:/TET/tet32/lib/ksh/tcm.ksh 678: .: create.ksh 83: not found The file is indeed present: -rwxrwxrwa 1 Administrators ENG-NT\staff \ 18341 Jul 30 1997 d:/TET/tet32/lib/ksh/tcm.ksh Answer I don't think that the problem is to do with the shell not being able
to find
I think that you have to read the diagnostic backwards like this:
This suggests that the shell is interpreting the line
(( i+=4 )) let "i+=4" (( i+=4 ))
simply runs the command
i+=4
in a subshell.
One way to write an arithmetic expression that is portable between the Korn Shell on UNIX systems and the MKS Shell on Win32 systems is: : $(( i += 4 )) Or you can say: case `uname -s` in Windows_NT|Windows_95) set -K ;; esac
|