e...@gmx.us wrote: > On 11/21/24 19:24, Bitfox wrote: > > Hi > > > > I have a interactive command like the following, > > > > $ ./filen > > / > upload upt-snappy / > > Uploading upt-snappy [========================================] 100% | ETA: > > 0s | 1.4 KiB / 1.32 KiB > > / > > > > > > > the command "filen" will open a interactive shell, and in this shell to > > upload/download files. > > > > How can I write a script for this case to upload file automatically? > > Can you do something like > echo "upload upt-snappy p" | ./filen
If that doesn't work, you may be able to script an interaction with expect Description: Automates interactive applications Expect is a tool for automating interactive applications according to a script. Following the script, Expect knows what can be expected from a program and what the correct response should be. Expect is also useful for testing these same applications. And by adding Tk, you can also wrap interactive applications in X11 GUIs. An interpreted language provides branching and high-level control structures to direct the dialogue. In addition, the user can take control and interact directly when desired, afterward returning control to the script. . This package contains the expect binary and several Expect based scripts.