You need to write a script that would open the connection in a separate ssh process, and then redirect the I / O from there with minor changes to the console. those. I imagine this as some while loop that would redirect every (almost every) command to ssh and return an answer from there. It is necessary to do this using standard shell tools so that it runs on android busybox. (ssh utility is present) The main question is how to send commands to the child process and get an answer? Once again, the logic is:

  1. running the command ssh xxx@xx.xx.xx.xx ghci

  2. ssh requires a password and I enter it, after which the ghci internal console starts

  3. various haskell commands are entered

But the main problem is that not all commands need to be immediately transferred via ssh to ghci , and some must first be processed in a special way on the client side and only then transferred. Therefore, I think that the script needs to be made so that it creates a child process and connects to it, and in the main process performs user interaction and the transfer of commands / output to the child process.

  • I need an example, because I can not write it :) I added more explanations, I apologize for the curvature of the description of the problem :) - artem
  • This is another explanation "first, process it in a special way on the client side and only then transfer it." - pyatak
  • Well, for example, if the user's command is abc, then send abcd to the server, and if: q, then send first: q, and then immediately exit - artem
  • one
    Something seems to me that you have chosen the wrong direction for solving the problem, the initial problem would be to hear, just what you still want to do is not clear to me, but most importantly, why? - pyatak
  • OK. Initial task: Make a sh script to run in the Android terminal emulator, which would connect via ssh to my server, launch ghci there and let me execute commands. In ghci there is a command: l module which allows you to load the module from a text file. I want to reload it in this script so that this very file is sent via ssh from the tablet to the server, and then launched there - artem

3 answers 3

To me, this TK reminds expect

  • Exactly! I forgot to write about it. But, unfortunately, it is not included in the buxybox kit, and I did not find it for android, and I myself lacked the knowledge to compile. - artem
  • And the device with android is very weak? Can there dissolve Linux in changjrut? there will be all the charms - ArcherGodson

scp to transfer files is not suitable in this case (not sure in the presence of busybox scp)? Connecting ssh via keys does not help? Maybe not in the topic I blur, but all the same;)

    2) ssh requires a password and I enter it

    everything, after that you communicate already with the remote machine.

    and no "standard shell" means you can no longer intervene in this dialogue.

    • ssh can execute commands and return the result to a host on which it is running, for example: ssh hostname df -h. And if you register the keys in the appropriate files, then you do not need to enter the password. - igaraev