You can use , the follow script (i extract this from officially script of "ioquake3") : for example
archs=`uname -m`
case "$archs" in
i?86) archs=i386 ;;
x86_64) archs="x86_64 i386" ;;
ppc64) archs="ppc64 ppc" ;;
esac
for arch in $archs; do
test -x ./ioquake3.$arch || continue
exec ./ioquake3.$arch "$@"
done
==================================================================================
I'm making a script to detect the "Architecture", this is my simple code (I am using it with wine , for my Windows Games , under Linux , by each game , i use diferrent version of WineHQ, downloaded from "PlayOnLinux" site.
# First Obtain "kernel" name
KERNEL=$(uname -s)
if [ $KERNEL = "Darwin" ]; then
KERNEL=mac
elif [ $Nucleo = "Linux" ]; then
KERNEL=linux
elif [ $Nucleo = "FreeBSD" ]; then
KERNEL=linux
else
echo "Unsupported OS"
fi
# Second get the right Arquitecture
ARCH=$(uname -m)
if [ $ARCH = "i386" ]; then
PATH="$PWD/wine/$KERNEL/x86/bin:$PATH"
export WINESERVER="$PWD/wine/$KERNEL/x86/bin/wineserver"
export WINELOADER="$PWD/wine/$KERNEL/x86/bin/wine"
export WINEPREFIX="$PWD/wine/data"
export WINEDEBUG=-all:$WINEDEBUG
ARCH="32 Bits"
elif [ $ARCH = "i486" ]; then
PATH="$PWD/wine/$KERNEL/x86/bin:$PATH"
export WINESERVER="$PWD/wine/$KERNEL/x86/bin/wineserver"
export WINELOADER="$PWD/wine/$KERNEL/x86/bin/wine"
export WINEPREFIX="$PWD/wine/data"
export WINEDEBUG=-all:$WINEDEBUG
ARCH="32 Bits"
elif [ $ARCH = "i586" ]; then
PATH="$PWD/wine/$KERNEL/x86/bin:$PATH"
export WINESERVER="$PWD/wine/$KERNEL/x86/bin/wineserver"
export WINELOADER="$PWD/wine/$Nucleo/x86/bin/wine"
export WINEPREFIX="$PWD/wine/data"
export WINEDEBUG=-all:$WINEDEBUG
ARCH="32 Bits"
elif [ $ARCH = "i686" ]; then
PATH="$PWD/wine/$KERNEL/x86/bin:$PATH"
export WINESERVER="$PWD/wine/$KERNEL/x86/bin/wineserver"
export WINELOADER="$PWD/wine/$KERNEL/x86/bin/wine"
export WINEPREFIX="$PWD/wine/data"
export WINEDEBUG=-all:$WINEDEBUG
ARCH="32 Bits"
elif [ $ARCH = "x86_64" ]; then
export WINESERVER="$PWD/wine/$KERNEL/x86_64/bin/wineserver"
export WINELOADER="$PWD/wine/$KERNEL/x86_64/bin/wine"
export WINEPREFIX="$PWD/wine/data"
export WINEDEBUG=-all:$WINEDEBUG
ARCH="64 Bits"
else
echo "Unsoportted Architecture"
fi
==================================================================================
Now i use this in my bash scripts , because works better in any distro .
# Get the Kernel Name
Kernel=$(uname -s)
case "$Kernel" in
Linux) Kernel="linux" ;;
Darwin) Kernel="mac" ;;
FreeBSD) Kernel="freebsd" ;;
* ) echo "Your Operating System -> ITS NOT SUPPORTED" ;;
esac
echo
echo "Operating System Kernel : $Kernel"
echo
# Get the machine Architecture
Architecture=$(uname -m)
case "$Architecture" in
x86) Architecture="x86" ;;
ia64) Architecture="ia64" ;;
i?86) Architecture="x86" ;;
amd64) Architecture="amd64" ;;
x86_64) Architecture="x86_64" ;;
sparc64) Architecture="sparc64" ;;
* ) echo "Your Architecture '$Architecture' -> ITS NOT SUPPORTED." ;;
esac
echo
echo "Operating System Architecture : $Architecture"
echo