DivineOmega/php-ssh-connection

multiple commands

vik0803 opened this issue · 2 comments

Hi,

I tried to use your package but it works well for every single command but when I use it within the for loop and have multiple commands in array it doesn't work as needed.

Eg:

cd /var/www/html
mkdir abc
cd abc
touch index.html

now if we execute inflow it should create index.html file in /var/www/html/abc folder.

but whereas using ssh connection in for loop it does create index.html file in /home/ubuntu folder.

content of /home/ubuntu folder is as below
folder:
abc
file
index.html

Appreciate your help if you can guide me to use it as above solution that I am looking forward for.

@DivineOmega hope you can help on this.

@vik0803 Hi there.

Try running the commands individually and calling getOutput and getError between each command.

Alternatively it may just be loosing track of the current active directory. In which case you could try concatenating your commands using &&.