Ssh commands failing from studio

hi im trying to connect a bluetooth device over ssh from an app i know to ssh is fine and logs in as i con run other commands and it all works fine if i just run commands from terminal but from studio my ubuntu machine throws

  • Changing power on succeeded
  • com.example.remote2 I/System.out: med1a@med1a-Lat:~$ bluetoothctl agent on
  • com.example.remote2 I/System.out: med1a@med1a-Lat:~$ bluetoothctl connect 98:B6:E9:5C:25:E4
  • System.out: Attempting to connect to 98:B6:E9:5C:25:E4
  • /System.out: [e[0;93mCHGe[0m] Device 98:B6:E9:5C:25:E4 Connected: yes
  • System.out: Failed to connect: org.bluez.Error.Failed

from command

MainActivity.altercommand(“bluetoothctl power off\nbluetoothctl power on\n bluetoothctl agent on\n bluetoothctl connect 98:B6:E9:5C:25:E4\n”);

however these commands can be copied and into terminal and they work seems maybe its more of a error on ubuntu side but it works from terminal just not android studio anyone have any ideas? thanks

i got around this but using a loop untill 2 devices where connected HOWERVER! now im having a problem using ls to get th contents of a folder it again works in terminal $ls /home/path/folder/ however when the same cmd it is run in studio it just echos back the path to folder not its contents wtf aargh anyone know what the prob could be?