Using a command file for a shell script.
#1
Since yoshi does a good job of ignoring lines that do not have yoshi commands, one can use the same file for a bash scrip. copy the foollowing and save the file as "viewtext" then set the executable bits. This will display the Yoshi command file in a text display, then chose to run yoshi Default or not depending on the cancel button.

Code:
#!sh
test="NO"
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd "$DIR"
yoshi viewtext > /tmp/yoshout

while IFS='' read -r line || [[ -n "$line" ]]; do
    var1=$(echo $line | cut -f1 -d=)
    var2=$(echo $line | cut -f2 -d=)
    eval $var1='$var2'
done < "/tmp/yoshout"

if [ "$test" == "yes" ]; then
# skip over yoshi commands


*.title = Welcome to Yoshi
#*.look = no-border
#*.look = Bordered
#*.look = Floating
#*.look = Modal
#*.x = 50
#*.y = 260
*.bgcolor = 255,232,181

img1.type = image
img1.path = /boot/home/config/settings/fatelk/yoshi/blank.gif
img1.maxwidth = 8
img1.maxheight = 8

img3.type = image
img3.path = /boot/home/config/settings/fatelk/yoshi/grey.png
img3.maxwidth = 500
img3.maxheight = 2
img.border = 5

img.type = image
img.path = /boot/home/config/settings/fatelk/yoshi/blank.gif
img.maxwidth = 8
img.maxheight = 8

txt.type = text
txt.txtfile = /boot/home/config/settings/fatelk/yoshi/commands/Yoshi
txt.lines = 15
txt.scrollbar = 1
txt.bg = white
#txt.align = center
echo;
fi

if [ $cancel -eq 1 ]
then
exit 1
fi
yoshi
Reply
#2
Interesting. You're relying on the fact that bash is a fairly primitive interpreter that works strictly line-by-line, unlike, say, the yab interpreter, which checks the entire program for errors before it is run. This opens up a lot of possibilities. I must think about this.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)
Free Web Hosting