Unfortunately, Puppy Wary uses bash 3.jamesbond wrote:If you can get this to work, it would be interesting.
coproc functionality comes with bash 4...
But it seems to me that using awk is fine anyway, or a mixture of awk and bash version 3.
Awk is a powerful programming language. Puppy users may be more familiar with bash, but awk is there on the system and not a memory hog when running, so perfectly good for programming gtk-server GUIs. So maybe this is a good time to practice/learn awk...
Quote from http://www.ibm.com/developerworks/linux ... index.html
http://www.grymoire.com/Unix/Awk.html:Sure, awk doesn't have a great name. But it is a great language. Awk is geared toward text processing and report generation, yet features many well-designed features that allow for serious programming. And, unlike some languages, awk's syntax is familiar, and borrows some of the best parts of languages like C, python, and bash (although, technically, awk was created before both python and bash). Awk is one of those languages that, once learned, will become a key part of your strategic coding arsenal.
Why is AWK so important? It is an excellent filter and report writer. Many UNIX utilities generates rows and columns of information. AWK is an excellent tool for processing these rows and columns, and is easier to use AWK than most conventional programming languages. It can be considered to be a pseudo-C interpretor, as it understands the same arithmatic operators as C. AWK also has string manipulation functions, so it can search for particular strings and modify the output. AWK also has associative arrays, which are incredible useful, and is a feature most computing languages lack. Associative arrays can make a complex problem a trivial exercise.
http://www.vectorsite.net/tsawk_1.html#m1:
As an example of memory usage, here is an extract from "top" showing the earlier gtk-server awk program running:Awk statements comprise a programming language. In fact, Awk is useful for simple, quick-and-dirty computational programming. Anybody who can write a BASIC program can use Awk, although Awk's syntax is different from that of BASIC. Anybody who can write a C program can use Awk with little difficulty, and those who would like to learn C may find Awk a useful stepping stone -- with the caution that Awk and C have significant differences beyond their many similarities.
There are, however, things that Awk is not. It is not really well suited for extremely large, complicated tasks. It is also an "interpreted" language -- that is, an Awk program cannot run on its own, it must be executed by the Awk utility itself. That means that it is relatively slow, though it is efficient as interpretive languages go, and that the program can only be used on systems that have Awk.
Code: Select all
PID PPID USER STAT VSZ %MEM CPU %CPU COMMAND
8624 8623 root S 21544 8% 0 0% gtk-server -stdin
...
8623 30060 root S 2320 1% 0 0% /bin/gawk -f gtkprog.awk
Code: Select all
PID PPID USER STAT VSZ %MEM CPU %CPU COMMAND
13739 1 root S 21432 8% 0 0% gtk-server -fifo /tmp/bash.gtk -detach
...
13737 30060 root S 2948 1% 0 0% gtkprog.bash