The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
within shell script send expect and if else mnmonu Shell Programming and Scripting 1 04-20-2009 05:41 AM
Using Expect results in a Shell script kaltekar Shell Programming and Scripting 2 10-17-2008 09:08 AM
Using expect script in a shell script or vice versa nua7 Shell Programming and Scripting 0 07-18-2008 07:16 AM
Need help with Expect and Shell script tonan Shell Programming and Scripting 1 04-10-2008 10:45 PM
Password changing in a Script (shell and expect) chellam Shell Programming and Scripting 1 08-14-2006 11:12 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 04-22-2009
mnmonu mnmonu is offline
Registered User
  
 

Join Date: Feb 2009
Posts: 32
within shell script send expect and if else

Hi,

I have written one shell script , using that i am able to connect to remote machine but i have to

#!/usr/bin/expect -f
set address [lindex $argv 0]
set username [lindex $argv 1]
set password [lindex $argv 2]
set OOLpath [lindex $argv 3]
set dbusername [lindex $argv 4]
set dbpasswd [lindex $argv 5]
set tnsname [lindex $argv 6]
set recdbusername [lindex $argv 7]
set recdbpasswd [lindex $argv 8]
set rectnsname [lindex $argv 9]
spawn ssh ${username}@${address}
expect "${username}@${address}'s password:"
send -- "${password}\r"
expect "$ "
send -- "cd ${OOLpath}\r"
expect "$ "
send -- "cd Client\conf\r"
##########IF-ELSE Block



expect eof

but I need to check if one file(named parfile) is exist or not and if exist then change some parameter value

cat parfile
dbtnsname = clienttns

dbuserid = scott

dbpasswd = tiger

and if not exist then copy from some directory and then change parameter dbuserid,dbpasswd value.


Please Please help me.Thanks in advance.
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 06:32 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0