Is there a way to use Expect-Lite variables inside of a spawned command?

Up vote 1 down vote favorite share g+ share fb share tw.

I've been working on trying to automate the complicated process of building source code on a build machine and then transferring the compiled image files over to my embedded ARMv7 device to be flashed. Each step by itself is easy to automate with standard Linux Shell Script, but when trying to do everything in one giant script things get complicated. Thus far I've been using expect-lite to do the work, which is working except now I've run into a problem.

When transferring the images over I have expect-lite code that looks like the following: $imageDestination="/the/destination" $imageSource="/the/source/" >sftp $userName'@'$buildMachine >$password >get $imageSource'/'x-load_sdcard.bin. Ift $imageDestination'/'MLO >echo "Finished" >bye If you know a thing or two about expect-lite, then you'll know that the above variables will be read as "Shell" variables. The problem is that as far as I know SFTP doesn't allow the use of variables.

Is there a way to tell expect-lite to use the predefined variables instead of trying to use "Shell" variables? Or, is there some cleaver way to get around this limitation without removing the variables? All help is greatly appreciated.

Sftp expect link|improve this question asked Mar 26 '11 at 0:40Drellgor113.

Dreligor, There is no scope issue. Expect-lite variables are all of global scope (as stated in the documentation). I think the problem is that you are using quotes which is making things more difficult.

You should try: $imageDestination=/the/destination $imageSource=/the/source sftp $userName'@'$buildMachine $password get $imageSource/x-load_sdcard.bin. Ift $imageDestination/MLO echo "Finished" bye Craig Miller - author and maintainer of expect-lite.

After some experimentation it turns out that this is a scope issue. The solution is to simply move the variable declarations down. They need to be declared after the script has connected to the remote machine via sftp.

The fixed code is as follows: >sftp $userName'@'$buildMachine >$password $imageDestination="/the/destination" $imageSource="/the/source/" >get $imageSource'/'x-load_sdcard.bin. Ift $imageDestination'/'MLO >echo "Finished" >bye Hopefully this will help others.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions