On Mon, 02 Dec 2013, Mike Crean wrote: > > Hey boys, I am trying to emulate the terminal string sudo sh -c > 'echo out /sys/class/gpio/gpio27/direction' (works OK in terminal, on > BBB wheezy arm lxde) I run this from gambas3.5.90 Exec [system.shell, > "sudo sh -c 'echo out /sys/class/gpio/gpio27/direction'"] > and get an error /bin/sh: 0: Can't open sudo sh -c 'echo out > /sys/class/gpio/gpio27/direction' any help please. >
If you write Exec [System.Shell, "sudo sh -c ..."], then the second string is the first and only argument to System.Shell. At least on my system, the default shell tries to execute that program. However, "sudo sh -c ..." is normally not a program. "sudo" is a program, "sh" is one and "-c" and "..." are arguments but the whole string is not a program name. You have to put them all in separate entries in the Exec array: Exec [System.Shell, "sudo", "sh", "-c", "..."]. > I > have also tried shell "sudo sh -c 'echo out > /sys/class/gpio/gpio27/direction'" this runs with out error and > but will not change data in the direction file. It stays at the old > value of "in". > > If > I run it from a terminal the string works fine. > > Thanks > in advance > Mike Are you really sure that the *same* command works in a terminal? I mean: $ sudo sh -c 'echo out /sys/class/gpio/gpio27/direction' All the echo's I have seen so far will *not* write "out" to /sys/class/gpio/gpio27/direction if called that way. They will just print "out /sys/class/gpio/gpio27/direction" literally. You may need to redirect "out" to the file like in $ sudo sh -c 'echo out >/sys/class/gpio/gpio27/direction' Regards, Tobi -- "There's an old saying: Don't change anything... ever!" -- Mr. Monk ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user