Problem in exporting variable from bash script to expect script
Assalam o Alaikum.
I can easily export variable from bash to bash script but not from bash to expect script. Here are my scripts: [root@Zohaib 04]# vim initiate_operation.sh #!/bin/bash gxip= 192.168.1.121 mkdir -p /tmp/logs_auto cp -n Email_words.txt /tmp/ export gxip expect auto.sh [root@Zohaib 04]# vim auto.sh #!/usr/bin/expect -f echo "$gxip" spawn ssh root@$gxip expect "*password*" { send "123\r" } [root@Zohaib 04]# . ./initiate_operation.sh can't read "gxip": no such variable while executing "echo "$gxip" " (file "auto.sh" line 8) |
Please use ***[code][/code] tags*** around your code and data, to preserve formatting and to improve readability. Please do not use quote tags, colors, or other fancy formatting.
Code:
gxip= 192.168.1.121 |
Wow, that took a lot of digging.
Your answer is found in the TCL/TK Wiki I hate redirection as an answer so here is what I got to work
|
Thanks you so much. it works thanks a lot............................................
|
All times are GMT -5. The time now is 07:37 AM. |