Subject: Re: Multiple Command executions pipeline

Re: Multiple Command executions pipeline

From: Peter Stuge <>
Date: Thu, 21 Jan 2010 20:19:21 +0100

Paresh wrote:
> Our application is working good to execute simple individual
> commands but it is not storing sessions.

libssh2 does not help you with this. You must implement it yourself.

> if I execute this sequence of commands, then, i want it to be
> executed like we execute it at terminal.
> i.e. it must display XYZ as pwd.

So you want to create a terminal program, but perhaps with an API
instead of a user interface. Please study what a terminal emulator
is, and all the software that it interacts with on the server. Also
investigate how to control a user shell from an application.

Please note that the shell is a USER interface, so it is very badly
suited for being controlled by your program.

> Our application displays root directory as PWD.

I don't understand what this means.

> also, i wanna implement script execution, i.e. if i make a script
> of commands, then, it would be executed like the script, at once, i
> don't need to execute command one by one.

I also don't understand this. As I am sure that you know, a script is
nothing but a series of commands. If you do not want to store this
series of commands on the server, then you must store them in your
client. If you store them in your client then you must send them one
at a time to the shell on the server.

> Please help me, I'm using libssh2.

You have not posted any question about libssh2, and the problem with
your application that you are trying to solve has nothing to do with
SSH or libssh2, so don't expect to get much help with it here.

> If anything we can do with libssh2 functions, like, session_init(),
> channel, etc?

No. These are all related to details in the SSH protocol, and it
seems to me that your problem is with remotely controlling a user
interface from a program. If anything I would suggest that you
contact shell developers and talk to them about the most suitable way
for another program to interact with a shell, but don't expect to get
much enthousiasm from them either.

Received on 2010-01-21