February 29, 2024, 06:16:23 AM

News : LinuxSolved.com Linux Help Community Forum..

Author Topic: Help with 'expect'  (Read 7331 times)

Offline GeoTor

  • New Member
  • Posts: 1
Help with 'expect'
« on: July 09, 2012, 01:05:20 AM »
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: [Select]
ssh_args="-o StrictHostKeyChecking=no" 

#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

 echo "CPE mac address == $mac"

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

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