1 May 2005 16:51
Re: using CLI from a script
Kevin Corry <kevcorry <at> us.ibm.com>
2005-05-01 14:51:19 GMT
2005-05-01 14:51:19 GMT
Hi Ross, On Sat April 30 2005 12:56 am, Ross Boylan wrote: > I'm interested in using the CLI from a script, probably python. The > problematic part is that I want to have a back and forth exchange with > the CLI. Is there any chance this will work? > > The likely sequence would be to do some queries to check that things > are in a proper state, then do some operations. Interspersed with my > pumping commands to the CLI it would be giving responses, which I'd > need to capture and interpret. > > Can I make any assumptions about this? Examples of assumptions I > would like to make are > * the CLI will take and respond to my inputs as they come in (I'm not > sure what I need to do to convince it the end of a command has > arrived--would sending \n work?, flushing the buffer? sending ":"?) The CLI doesn't do any internal buffering of input, so as it receives a complete command, it will process that command. Depending on the method that your program is using to actually send those commands to the CLI, you may require some kind of buffer flushing. If you're program opens the CLI as if it were actually being run from the command-line, then a \n would probably be enough to distinguish between commands. Or you can use the ":" character between commands just to be safe. > * the responses will be unbuffered enough that they won't sit in > neverland while I wait for them(Continue reading)
RSS Feed