On 11/21/24 19:37, Bitfox wrote: > On 2024-11-22 08:28, 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 >> ? > > That seems impossible. > > $ echo "upload tmp" |./filen > upload tmp > Error trying to prompt for user input: readline was closed. (maybe you're in > an environment without stdin, like a Docker container) > Error [ERR_USE_AFTER_CLOSE]: readline was closed
I'm not familiar with filen. Does it have an option like "read input from file X"? Or heck use expect, as others have suggested.