I needed a bash script which would only launch a program on a Raspberry Pi if there was enough memory dedicated to the GPU.
I pulled this script together which checks to see if there is at least 128 MB dedicated to the GPU before starting the program.
#check there is enough gpu memory to start
#get the gpu memory and output to a file called gpu_mem
vcgencmd get_mem gpu > gpu_mem
#strip last char from the output (i.e. 64M)
if (( $gpu >= 128 )); then
echo "The program needs at least 128MB of memory allocated to the GPU"
echo "Use sudo raspi-config (Advanced Options > Memory Split) to change"
#remove the gpu_mem file