Code: Select all
#!/usr/bin/bash
gtk-server -ipc=$$ -log=/tmp/$0.log &
sleep 1
CMDs='
gtk_init "NULL NULL"
winMAIN gtk_window_new 0
gtk_window_set_title $winMAIN "Win._Title"
gtk_window_set_position $winMAIN 1
tblMAIN gtk_table_new 10 10 1
gtk_container_add $winMAIN $tblMAIN'
ipc() { eval $1=`gtk-server msg=$$,"$2 $3 $4 $5 $6 $7"`; }
echo "$CMDs" |while read CMD
do
[ ! "$CMD" ]&& continue
[ "`echo "$CMD" |grep '^#'`" ]&& continue
if [ "`echo $CMD |grep '^gtk'`" ];then
echo -e '\n### CMD ### '"$CMD"
ID=`gtk-server msg=$$,"$CMD"`
echo '### RET = '"$ID"
else
echo -e '\n### NEW ### '"$CMD"
ipc $CMD
echo '### $winMAIN = '$winMAIN' ### $tblMAIN = '$tblMAIN
fi
done
the variables are treated as literals ( the output lines: ### CMD ### .......).
The last echo line shows the 2 variables have the values in them.
It seems the variables don`t evaluate to their values and gtk-server errors.
Also it can`t make the log file ( I can`t see the problem there...):
Error: ( WARNING: The logfile could not be created. )