Currently I am doing essentially this:
if [[ "$OSTYPE" == "linux-gnu" ]]; then
echo "a"
elif [[ "$OSTYPE" == "darwin"* ]]; then
echo "b"
elif [[ "$OSTYPE" == "cygwin" ]]; then
echo "c"
elif [[ "$OSTYPE" == "msys" ]]; then
echo "d"
elif [[ "$OSTYPE" == "win32" ]]; then
echo "e"
elif [[ "$OSTYPE" == "freebsd"* ]]; then
echo "f"
else
echo "g"
fi
This would probably work fine for the major 3 systems (mac, windows, linux), but what about raspberry or raspberry bare metal, or other custom operating systems. Is there a way to instead check for the architecture, and is that typically done / is it sufficient? Can you actually write programs that target a specific architecture rather than an OS? I'm new to this, basically wondering if there's a way to write bash scripts and C such that it would work on bare metal machines or other obscure systems, that still use either x86 or arm.