$ cat collectversion.sh
#!/bin/bash
######################################################################
export https_proxy=http://10.xx.xx.xx:8080


flash() {
echo ""
echo "====================================================================="
echo "            ---> Collecting the Binaries Versions <---               "
echo "====================================================================="
echo '              \\\|///                 '
echo '            \\  - -  //               '
echo "             (  @ @  )                "
echo "      -----oOOo-(_)-oOOo------------- "
echo "     |                               |"
echo "     | `date "+%d/%m/%Y"` Wissem MEDIOUNI    |"
echo "     | [email protected]   |"
echo "     |                               |"
echo "      ------------------------------- "
echo "====================================================================="
echo "            ---> Collecting the Binaries Versions <---               "
echo "====================================================================="
echo ""
}

#flash


flash1() {
echo ""
echo "====================================================================="
echo "            ---> Collecting the Binaries Versions <---               "
echo "====================================================================="
echo "      ------------------------------------------- "
echo "     | `date "+%d/%m/%Y"` Wissem MEDIOUNI     |"
echo "     | [email protected]   |"
echo "      ------------------------------------------- "
echo "====================================================================="
echo "            ---> Collecting the Binaries Versions <---               "
echo "====================================================================="
echo ""
}


collecting() {
for i in twse03 tomx01 dchix01 tpice01 gltcme3 tstream01-25 tstream01-26 tstream02-25 tstream02-26 Relay11M Relay11B Relay11-32M Relay11-32B jumpbox
        do
                name=$i
                JUMP="N"
                case $i in
                        twse03)
                                platform="Natif WSE"
                                adress="10.xx.xx.xx";;
                        tomx01)
                                platform="Natif OMX"
                                adress="10.xx.xx.xx";;
                        dchix01)
                                platform="Natif CHIX"
                                adress="10.xx.xx.xx";;
                        tpice01)
                                platform="Natif Ice/Ipe"
                                adress="10.xx.xx.xx";;
                        gltcme3)
                                platform="Natif CME"
                                adress="10.xx.xx.xx";;
                        tstream01-25)
                                platform="Relais 9.1 Master"
                                name="tstream01"
                                adress="10.xx.xx.xx";;
                        tstream01-26)
                                platform="Relais 9.1 Slave"
                                name="tstream01"
                                adress="10.xx.xx.xx";;
                        tstream02-25)
                                platform="Relais 10.1 Master"
                                name="tstream02"
                                adress="10.xx.xx.xx";;
                        tstream02-26)
                                platform="Relais 10.1 Slave"
                                name="tstream02"
                                adress="10.xx.xx.xx";;
                        Relay11M)
                                platform="Relais 11.1 Master 64bits"
                                name="tstream01"
                                adress="10.xx.xx.xx";;
                        Relay11B)
                                platform="Relais 11.1 Slave 64bits"
                                name="tstream01"
                                adress="10.xx.xx.xx";;
                        Relay11-32M)
                                platform="Relais 11.1 Master 32bits"
                                name="tstream01"
                                adress="10.xx.xx.xx";;
                        Relay11-32B)
                                platform="Relais 11.1 Slave 32bits"
                                name="tstream01"
                                adress="10.xx.xx.xx";;
                       jumpbox)
                                platform="Natif Ice/Ipe"
                                name="wmmi"
                                JUMP="Y"
                                adress="10.xx.xx.xx";;
                           *)
                                exit 1
                esac

        if [ $JUMP = "Y" ]
                then

                #       ssh [email protected] "bash ~/script.sh" ; echo "fin Traitement acces Jumpbox"
                        ssh [email protected] "bash ~/script.sh" | grep -v "spawn" | grep -v ".. Waiting .." ;echo ""
                        echo "Ending The Collect for the Platforms with Jumpbox Access"
                else

export name
export adress
echo "==================> $platform <=================="
echo "`date "+%Y%m%d"`"

echo "Version du SLEV5 :"
ssh $name@$adress "cat productname01/log/P10_`date "+%Y%m%d"`.log | grep '##   Version   :' | tail -1"
echo ""

echo "Version du SELV5 :"
ssh $name@$adress "cat productname02/log/selv5_`date "+%Y%m%d"`.log | grep '## version:' | tail -1"
echo ""

echo "Version du GLTS  :"
ssh $name@$adress "cat productname03/log/glts_`date "+%Y%m%d"`.log | grep '## version:' | tail -1"
echo ""


                fi
done

}

flash1

collecting
echo  "Ending The Collect for All the Permanent Environments Platforms"
#exit $exitCode
exit