syntax error: `$' unexpected

Hi all,
Am very new to Unix and am currently Involved in Migrating some Shell Scripts from AIX 4 to Solaris 10.

While using teh for loop am getting the below error:

$ echo $SHELL
/usr/bin/ksh
$ for file in $(ls *SEBE*)
syntax error: `$' unexpected

while the same works without issue on AIX.

Please Help!!!

well, try to switch to bash/sh, on my test Solaris 9 system, that construct works well; and don`t forget, that you`ll need to expand your script to something like this:

for file in $(ls -la) ; do echo $file; done

Tried Switching, but does not work

$ echo $SHELL
/usr/bin/ksh
$ SHELL=/bin/sh
$ echo $SHELL
/bin/sh
$ for file in $(ls -la)
syntax error: `$' unexpected
$

Read a Post that kron shell does not support $(COMMAND) and must use `COMMAND`
tried that way and it works.
But i was expecting that if i am Adding the line

#!/bin/ksh
as the first line in my Script, it should work.
So My Script
#!/bin/ksh
  
set -a
  
for file in $(ls *SEBE*)
do
  tfile=$(basename $file)
  echo "File name is $tfile"
done
set +a

must ideally work, But does not and i have to change it to:

#!/bin/ksh     # Set Korn Shell Environment

for file in `ls *SEBE*`
do
  #
  # Get the file name to process.
  #
  tfile=`basename "$file"`
  echo $tfile
done

Experts Does teh above make any Sense?

If it works, it works. Solaris tends to have very old nonposix shells for compatibility reasons, though I'd previously believed at least ksh was relatively modern...

First of all I'd like to say, that AFAIK simply setting the SHELL variable does not actually change the current shell.

[myuser@myhost /]$ echo $0
bash
[myuser@myhost /]$ echo $SHELL
/usr/local/bin/ksh93
[myuser@myhost /]$ SHELL=/bin/sh
[myuser@myhost /]$ echo $SHELL
/bin/sh
[myuser@myhost /]$ echo $0
bash
[myuser@myhost /]$ /bin/sh
$ echo $0
/bin/sh
$

Second: AFAIK it's not a good idea to use ls in that manner, why not simply try following:

for file in *SEBE*

Third: IMHO that basename part it completely unnecessary in this case.