Skip to contentSkip to conversation

Script Preprocessor

Buildroot Patrick 1 participant 1 message Sep 2, 2008

lore
Share & tools
lore

Patrick

author
#0 lore raw

Hello
Currently im thinking about a way to handel our init scripts.

In some Scripts we have some ugly code like

##########
fw_printenv device >/tmp/device
. /tmp/device

if [ "$device" = "X" ]
then
echo This is device X
fi

if [ "$device" = "X" -o "$device" = "Y"]
then
echo This is device X or Y
fi
##########

This is not the way it should be.
This could be resolved on build time.
Did anybody know a solution?

I could write a Script which could preprocess a file like this. A line begins with"#X" meens if [ "$device" = "X" ] then ..... fi

##########
fw_printenv device >/tmp/device
. /tmp/device

#X echo This is device X
#X||Y echo This is device X or Y
##########

Maybe there is already a solution?

Best regards
Patrick Fischer