B4J Question hShell on Raspberry

Drago Bratko

Active Member
Licensed User
Longtime User
In shell of Raspberry, when I run command :
echo "some text to be printed" >> /dev/usb/lp0
it get's printed on USB POS printer.

So, this same command I'm trying to send from inside application. Code is this :
B4X:
    Dim shl As Shell
    shl.Initialize("shl", "echo", Array As String("some text to be printed", ">>", "/dev/usb/lp0"))
    shl.WorkingDirectory = File.DirApp
    shl.Run(-1)

On ProcessCompleted i got this :
Success:true
ExitCode:0
StdOut:Hello > /dev/usb/lp0
StdErr:

But nothing is printed.

Any ideas ?
 

Drago Bratko

Active Member
Licensed User
Longtime User
Thank you for your answer and for the link.
Same thing ... unfortunately not working also like that.

For the record, I have done it another way ... I do create bash script from my application, give bash script privilege to run, and execute it with shell run command. To script I can send parameters, so basically quite flexible solution. Not most elegant one, but works.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…