1) ksh in unix is different from ksh in linux, while the information on google is basically for ksh in linux.
For example, the for loop under unxi cannot be written in this way.
For I in {1 .. 10}; do
But like this:
I = 1 <br/> while [[$ I lt 10]; do <br/> I =$ ($ I + 1) <br/> done
2) The equal signs of the assignment statement cannot contain spaces on both sides.
3) You can directly use $ (expression) instead of expr for variable calculation ))
4) the return value of Sqlplus may contain a line break. set pagesize 0 heading off feedback off verify off must be forced.
For example:
#! /Bin/ksh <br/> return_var = 'sqlplus-s scott/tiger @ ora_db <EOF <br/> set pagesize 0 heading off feedback off verify off <br/> select username from users where userid = 1; <br/> EOF '</p> <p> if ["$ return_var" = "Tom"]; then <br/> echo "YES" <br/> fi </p> <p> echo "-----------------" <br/> echo "mm $ {return_var} adbd" <br /> echo "-------------------" <br/>
Screen output
YES
-------------------
MmTomadbd
-------------------
If set pagesize 0 is not added, the screen output is
-------------------
Mm
Tomadbd
-------------------