Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

20
LINES

< > BotCompany Repo | #208 // BASH access test

Lua code

assert(bash_start, "Sorry: Need privileges. (e.g.: run -power 208)")

bash_start()
bash_send('date\n')
--bash_send('date\n')
bash_send('exit\n')

for i=1, 10 do
  os_sleep(500)
  local alive = bash_alive()
  out, err = unpack(bash_poll())
    
  -- print err first so bash output looks prettier.
  if err ~= '' then print(err) end
  if out ~= '' then print(out) end
  if not alive then break end
end

if bash_alive() then bash_kill() end
return 'ok'

test run  test run with input  download  show line numbers   

Travelled to 12 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

Comments [hide]

ID Author/Program Comment Date
473 #1000610 Edit suggestion:
!636
!629

main {
static Object androidContext;
static String programID;

public static void main(String[] args) throws Exception {
assert(bash_start, "Sorry: Need privileges. (e.g.: run -power 208)")

bash_start()
bash_send('date\n')
--bash_send('date\n')
bash_send('exit\n')

for i=1, 10 do
os_sleep(500)
local alive = bash_alive()
out, err = unpack(bash_poll())

-- print err first so bash output looks prettier.
if err ~= '' then print(err) end
if out ~= '' then print(out) end
if not alive then break end
end

if bash_alive() then bash_kill() end
return 'ok'
}}
2015-08-18 16:39:16  delete 
471 #1000604 (pitcher) 2015-08-20 15:28:24

add comment

Image recognition results

Recognizer Recognition Result Visualize Recalc
#308 468 [visualize]

Snippet ID: #208
Snippet name: BASH access test
Eternal ID of this version: #208/1
Text MD5: b2af831c8d62b2a384cf08d59cb0dc19
Author: stefan
Category:
Type: Lua code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2014-01-25 16:13:39
Source code size: 468 bytes / 20 lines
Pitched / IR pitched: Yes / Yes
Views / Downloads: 1594 / 284
Referenced in: [show references]