Zend certified PHP/Magento developer

can’t find bash history executed via ruby net::sh library

In the hope for getting the commands that run via ruby net::ssh tool which is described as follow:

Net::SSH is a pure-Ruby implementation of the SSH2 client protocol. It
allows you to write programs that invoke and interact with processes
on remote servers, via SSH2.

I added many variations to my .bashrc like this:

shopt -s histappend
export PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND$"n"}history -a; history -c; history -r"

and this:

shopt -s histappend
PROMPT_COMMAND='history -a;history -n'

and this

shopt -s histappend
PROMPT_COMMAND='history -a'

None of these worked, when I check my /root/.bash_history I can only see the command I executed myself by hand when being connected to my remote server.

Here is an example of a ssh::net script I am using:

Net::SSH.start("IP-ADDRESS-OF-REMOTE-SERVER-HERE", "root") do |ssh|

  ch = ssh.open_channel do |ch|
    ch.exec "echo this should be logged in .bash_hisory" do |_, success|

      puts success
      abort "could not execute command" unless success

      ch.on_data do |_,data|
        puts data
      end

      ch.on_request("exit-status") do |_, data|
        puts "Exit"
      end
      ch.on_close do |ch|
        puts "Closing!"
      end

    end
  end

  ssh.loop
end

What I want is to see the commands executed in other sessions including the ones from net::ssh