How to convert string into integer in shell scripting?

Hi All,

sessionid_remote=$(echo "select odb_sessionid from sysopendb where odb_dbname='syscdr';" | sudo -u cucluster ssh ucbu-aricent-vm93 "source /opt/cisco/connection/lib/connection.profile; $INFORMIXDIR/bin/dbaccess sysmaster@ciscounity")

for sid in $sessionid_remote;do
        if [[ $sid = *[!0-9]* ]]; then
                continue
        else
                if [ $sid = "4089" ]; then
                        echo "hi"
                sudo -u cucluster ssh ucbu-aricent-vm93 'sudo -u root /bin/sh /opt/cisco/connection/bin/cucdb onstat -'
                 sudo -u cucluster ssh ucbu-aricent-vm93 'sudo -u root /bin/sh /opt/cisco/connection/bin/cucdb onmode -z $sid'
                fi
                echo $sid
        fi

done

This is my script above but it is failed to run command

sudo -u cucluster ssh ucbu-aricent-vm93 'sudo -u root /bin/sh /opt/cisco/connection/bin/cucdb onmode -z $sid'

because onmode takes unsigned integer with option -z since the value of $sid is string so it is not accepting
Please tell me how should i convert the value into number so that it would be acceptable

???
How this work:

sudo -u cucluster ssh ucbu-aricent-vm93 'sudo -u root /bin/sh /opt/cisco/connection/bin/cucdb onmode -z 4089'

If that works and

sudo -u cucluster ssh ucbu-aricent-vm93 'sudo -u root /bin/sh /opt/cisco/connection/bin/cucdb onmode -z $sid'

not then sid value is not 4089. If you give argument 4089 in the commandline, it's command problem handler it, not shell/caller problem. Args are always strings for the command.

It doesn't work because variables do not expand inside single quotes ' ' , use double quotes " " .