i have an existing ftp script that needs to be translated to SFTP so i have to use expect script to automate the login to the remote server.
Now im facing with a problem becaise i have at least 50 files to be renamed ont he remote server. It's a hassle to hardcode every single command inside the expect script and because the filename is also changing according to date. So im thinking of putting the commands in a singel file name which will be read by teh expect script.
The file will look like:
I know this can be easily done with shel using the while read LINE command but not sure how to do this inside expect script.
Is is possible to do it in expect or they have a similar WHILE command in expect. If they have, really appreciate your help.
i have an existing ftp script that needs to be translated to SFTP so i have to use expect script to automate the login to the remote server.
You don't need expect to automate the login anymore(which is fortunate, since that's a very poor security practice.) ssh/scp/sftp (all the same protocol, ultimately) let you use a pre-shared key instead, much simpler, easier, more secure, and less bug-prone.
Quote:
Now I'm facing with a problem becaise i have at least 50 files to be renamed on the remote server. It's a hassle to hardcode every single command inside the expect script and because the filename is also changing according to date.
If sftp is available, ssh may also be available, which would let you run a full-fledged shell script on the remote host. You could do:
..and therein feed the local script 'myscript.sh' into the remote host and execute it there. If shared keys are set up, this will happen without a password -- all is needed are the right keyfiles in the right places.
Otherwise, you could do something like:
Last edited by Corona688; 09-02-2010 at 01:20 PM..
Hi everybody,
I am new at Unix/Bourne shell scripting and with my youngest experiences, I will not become very old with it :o
My code:
#!/bin/sh
set -e
set -u
export IFS=
optl="Optl"
LOCSTORCLI="/opt/lsi/storcli/storcli"
($LOCSTORCLI /c0 /vall show | grep RAID | cut -d " "... (5 Replies)
Hi I have two scripts one is Expect and other is shell.
I want to merge Expect code in to Shell script so that i can run it using only one script. Can somebody help me out ?
Order to execute: Run Expect_install.sh first and then when installation completes run runTests.sh shell script.
... (1 Reply)
I am trying to execute expect command inside by small bash script to login into servers using key authentication method. My script is as follows:
#!/bin/bash
HOST=$1
/usr/bin/expect -c "
spawn ssh -i /root/.ssh/id_rsa root@$HOST
expect -exact "Enter... (3 Replies)
I have an expect script called remote that I want to call from inside my expect script called sudoers.push, here is the code that is causing me issues:
set REMOTE "/root/scripts/remote"
...
log_user 1
send_user "Executing remote script as $user...\n"
send_user "Command to execute is: $REMOTE... (1 Reply)
I have an expect script which is run inside a bash script. I am trying to ssh to a jump server then from the jump server telnet to each router in a file list and run the same command. I tried many ways but down not read the router list file for some reason.
I get the following error:
wrong #... (0 Replies)
Shell Scipt: temp.sh
su - <$username>
expect pass.exp
Expect script: pass.exp
#!/usr/bin/expect -f
# Login
#######################
expect "Password: " send "<$password>\r"
it comes up with Password: but doesnt take password passed throguh file. (2 Replies)
Hi,
Am very new to expect scripting..
Can You please suggest me how to call an expect script inside another expect script..
I tried with
spawn /usr/bin/ksh
send "expect main.exp\r"
expect $root_prompt
and
spawn /usr/bin/ksh
send "main.exp\r"
expect $root_prompt
Both... (1 Reply)
Hi
I'm trying to run a script " abc.sh" which triggers "use.sh" .
abc.sh is nothing but a "expect" script which provides username and password automatically to the use.sh script.
Please find below the scripts:
#abc.sh
#!/usr/bin/expect -f
exec /root/use.sh
expect "*name*"
send... (1 Reply)
hii,,
I am trying to automate jira. during my scripting using bash script, in the terminal i got the terminal message like this:
"Configure which ports JIRA will use.
JIRA requires two TCP ports that are not being used by any other
applications on this machine. The HTTP port is where you... (1 Reply)