Running a multiline shell command

Bernard Devlin bdrunrev at gmail.com
Sat Dec 10 06:53:04 CST 2011


Could it be an issue with the "return" character?  As you know, they are
different on each platform.  You could try variations between ascii 10 and
13.

If you have it working as a script on your file system, you could try
putting that script into a custom property (get hold of it using a binfile
URL schema).  If that can be successfully passed to telnet and you get the
response you expect, then you know that the problem lies elsewhere.  Whilst
tracking down the problem, I'd get it working with the correct username and
password in the script on the filesystem, then with those in place move
that script into the stack as a binary object, and worry about substituting
them later for deployment.

Bernard

On Sat, Dec 10, 2011 at 2:50 AM, Bob Sneidar <bobs at twft.com> wrote:

> This has been discussed before, but I am trying to run multiple lines of
> shell commands using the shell() function. It looked like it worked at
> first, only the telnet session dumped me before I could get any information
> out of the switch. Now it looks like I am not even talking to the shell
> anymore. The shell script looks like this:
>
> script "/users/shared/macaddresses.txt"
> telnet 172.16.0.121
> theUser
> thePassword
> print "show mac-address"
>
> exit
> exit
> y
> n
> script off
>
> I have this in a stack property, and put it into a variable. I replace
> theUser and thePassword with the actual credentials before running shell().
> The result is empty. I have executed the above commands line by line in a
> terminal and I do end up with a file with the output of the shell window as
> neat as you please. But when I try to execute within Livecode using the
> shell() function I get squadouche.
>
> The goal is to get the mac address table from a Procurve managed switch.
> Any ideas?
>
> Bob
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>


More information about the use-livecode mailing list