LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-08-2012, 07:59 PM   #1
geotor
LQ Newbie
 
Registered: Jul 2012
Posts: 1

Rep: Reputation: Disabled
Help with 'expect'


hi guys I am in need for some 'expect' scripting help

I have the following bash script and need to make this automated using the same password everytime (since i am configuring different deviced everytime, I can not use SSH Key for this)

Can anyone tell me how to integrate the 'expect' usages into this script so that MySecrectPass will be used to log into the ssh and transfer the files and get mac address:

please find the bits I need automated below

Code:
#Get the mac address
mac=$(echo "ip -o link show dev eth0  | sed 's/.*link\/ether \([0-9:a-f]*\).*/\1/g'" | ssh $ssh_args $login)

if [[ $mac == "" ]]; then
      exit
fi

 echo "CPE mac address == $mac"

scp $ssh_args -r system.cfg $login:/tmp/  

scp $ssh_args cp ../XM* $login:/tmp/fw.bin

Last edited by geotor; 07-08-2012 at 08:03 PM.
 
Old 07-08-2012, 08:15 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
Read this: https://www.linuxquestions.org/quest...rd-4175415027/
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Expect script: how do i send function key F12 in an expect script alix123 Programming 4 09-01-2013 09:06 PM
[SOLVED] /usr/bin/expect : Script to check server load using both expect and bash Soji Antony Programming 1 07-27-2010 11:27 PM
expect: line seems to match exactly, however expect thinks not deadeyes Linux - General 5 06-16-2010 06:05 PM
Calling expect scripts from other expect scripts sevapopov Linux - Software 3 04-03-2008 09:33 PM
Expect.pm slamster Programming 1 04-18-2006 02:50 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:03 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration