[Gambas-user] Getting Feedback from EXEC
Benoît Minisini
gambas at ...1...
Sat Nov 12 15:33:29 CET 2011
Le 11/11/2011 17:48, JC S a écrit :
> Hello all.
> I want to use exec to run xterm and a bash script and I want to store
> the returned information a some form of string.
>
> something like:
> EXEC ["xterm, " - hold ", " - e ", " #! / Bin / bash; MYFCpid = $(ps
> ux | awk '/game-engine/&& !/awk/ {print $2}'); if [[ -n $MYFCpid ]];
> then ps -p $MYFCpid -o %cpu | sed -n 2p; else echo \"game-engine
> instance not found running.\"; fi "]
>
> This *should* return the average CPU use of game-engine as well, in the form of:
> "
> pc at ...121...$ BashScript
> 24
> $
> "
> Which means that it might have line terminating characters as well,
> eg. "\n" , but I'm not entirely sure.
>
>
> Thanks!
>
The fastest way is using the "EXEC ... TO <variable>" syntax. See the
wiki for the details.
Regards,
--
Benoît Minisini
More information about the User
mailing list