The sh
shell don't generally understand arrays as they are not part of the POSIX standard. The filename of the script is arbitrary, so a .sh
or a .ksh
filename suffix means nothing whatsoever.
Also, your array assignment syntax is a bit wrong (too many spaces). Corrected, it would look like
tableList=( Value1 Value2 Value3 )
Note the lack of blanks between the end of the variable's name and the (
.
To be able to run your script, you would need to execute it with a shell that implements arrays, such as ksh93
, bash
, zsh
, or yash
(depending what other shell constructs you are using). Note that ksh
on AIX is ksh88
which has a slightly different syntax for assigning values to arrays (it uses set -A tableList Value1 Value2 Value3
).
The best way of running your script with ksh93
is to add a #!
-line to the top of the script, pointing to the ksh93
interpreter, and then make the script executable with chmod +x scriptname
.
To use the ksh93
shell on AIX, the very first line of the script should look like
#!/usr/bin/ksh93
After that, don't specify an explicit interpreter on the command line when you run the script:
./scriptname
#!
as the first line of the script. e.g.#!/bin/sh
,#!/bin/ksh
or#!/bin/bash
. Then make the file executable. – ctrl-alt-delor Nov 16 '19 at 17:19