Error while sudo to instance via bash script

Team ,

I am trying to sudo to instnace using a shell script .In out put i am getting this error for every line ...I am running this script as root ..

sudo su - userid -i db2 "command " 

Error

/etc/profile[233]: shopt: not found [No such file or directory] 

how can we overcome this error ? Can someone help on this ?

examine the /etc/profile file and see line 233, it seems that someone has written a bash_profile over /etc/profile (shopt is a bash shell builtin)