This is easier than it sounds:
#!/bin/sh
yourfunctiona(){ ...; }
...
yourfunctionz(){ ...; }
. /path/to/file/with/more/functions
while read COMMANDS; do
eval "$COMMANDS"
done
read -p, -t, , -... , tailbox
touch /tmp/mycmdline
Xdialog --tailbox /tmp/mycmdline 0 0 &
COMMANDS="echo "
while ([ "$COMMANDS" != "" ]); do
COMMANDS=`Xdialog --stdout --inputbox "Text here" 0 0`
eval "$COMMANDS"
done >>/tmp/mycmdline &
eval $COMMANDS
NUMCORES=$(awk '/cpu cores/{sum += $4}END{print sum}' /proc/cpuinfo)
for i in {1..$NUMCORES};do
if [ $i -eq $NUMCORES ] &&
if [ -d /proc/$threadarray[$i] ]; then
continue
else
$COMMAND &
threadarray[$i]=$!
break
fi
done
, .
while, ,
(, )
:
wait $threadarray[$i]
:
wait
#I ended up using this to keep my load from getting to high for too long
: , , case
, (, , , , , )