Im using the ftp command line tool and want combine scripted input with user input. With only user input the prompt looks like this:ftp>But when I try to insert some input with a script, like{echo user username passwd; cat;} | ftp -n server.tldHow can I force ftp (or any cli) to still use the interactive mode?I would prefer a solution based on standard shell tools.
Writing to an interactive prompt
shell;io redirection;ftp
There is a program to interact with interactive command line tools exactly like the ftp example: expect.  It is a specialized script shell, extending the on the scripting language tcl.It is very powerful, but you may get away without learning everything about it. A very useful tool is autoexpect, which can record an interactive session as an expect script. The recorded script is certainly helpful to understand the basics.A expect script can interact with an interactive program like ftp. This can be combined with interaction of the user and the interactive program. Using the command interact in an expect script, the control can be given to the user temporarily.While the user has control, the script still listens for events to take back the control, so practically, both the user and the script are interacting simultaneously with the program.