Sunday, 18 June 2017

Expect command steps in bash



EXPECT COMMAND:-
======================================================================================================

[root@tlntatl14 Naveen]# cat patch.sh
Userid=naveen.janjanam@*****.com
Password=**********                      # give the password
echo "Enter the patch number:"
read Pno
expect -c "
spawn sh /u51/ar121/patch/get_MOS_patches.sh patch=$Pno
expect \"Userid:\"
send \"$Userid\r\"
expect \"Password:\"
send \"$Password\r\"
interact
"
ls -ltr *$Pno*

out:-
=============================
[root@tlntatl14 Naveen]# sh patch.sh
Enter the patch number:
24828024
spawn sh /u51/ar121/patch/get_MOS_patches.sh patch=24828024
Oracle Support Userid: naveen.janjanam@tieto.com
Oracle Support Password:

Getting patch 24828024 for "Linux x86-64"
1 - p24828024_R12.AP.C_R12_GENERIC.zip
2 - p24828024_R12.AP.B_R12_GENERIC.zip
Comma-delimited list of files to download: 2
Downloading file p24828024_R12.AP.B_R12_GENERIC.zip ...
p24828024_R12.AP.B_R12_GENERIC.zip completed with status: 0

Getting patch 24828024 for "Norwegian (N)"
no patch available
-rw-r--r-- 1 root root 63375 Oct 14  2016 p24828024_R12.AP.B_R12_GENERIC.zip_old
-rw-r--r-- 1 root root 63375 Oct 14  2016 p24828024_R12.AP.B_R12_GENERIC.zip