Currently the posts are filtered by: xxsvideo
Reset this filter to see all posts.
Debian and Ubuntu changed the default shell /bin/sh from bash (Bourne Again Shell) to dash (Debian Almquist Shell).
The advantage of dash is its size, speed and POSIX compliance. The disadvantage is that many scripts written for bash won't work anymore because bash has specific features - so called "bashisms".
Â
One of this bashisms, I used frequently in the xxsvideo build system is the " indirect variable expansion". Which makes it possible to execute the following script:
#!/bin/bash                                                                                                                                      Â
                                                                                                                                                 Â
CONFIG_BUSYBOX=y
PACKAGENAME="BUSYBOX"
PACKAGECONFIG=CONFIG\_$PACKAGENAME
if [ "${!PACKAGECONFIG}" = "y" ]; then
       echo $PACKAGENAME "is selected"
else
       echo $PACKAGENAME "is NOT selected"
fi
If you call this script with bash you receive as expected "BUSYBOX is selected".
With dash you see:
./test.sh: 13: Bad substitution
I was looking a long time for the right way to replace this {!VAR} statement. But it's quite simple and suddenly I found a thread describing it:
#!/bin/dash
CONFIG_BUSYBOX=y
PACKAGENAME="BUSYBOX"
PACKAGECONFIG=CONFIG\_$PACKAGENAME
if [ "$(eval echo '$'$PACKAGECONFIG)" = "y" ]; then
   echo $PACKAGENAME "is selected"
else
   echo $PACKAGENAME "is NOT selected"
fi
Â
In short: With dash you write:
eval echo '$'$VARIABLE
which is equivalent to bash
echo ${!VARIABLE}
Â
... I think ;-)
Â
On Sourceforge.net I'm still one of the maintainer of the xxsvideo linux build system. This buildsystem was started in 2007 by the small German company mycable GmbH for it's embedded development boards.
Tomorrow, I will release version 0.8.4 after 10 months of development. Ok, I didn't work 10 months every day on it. So it's more or less a bugfix release which is necessary because many packages were updated in the meantime or download server address changed.