Skip to content

Instantly share code, notes, and snippets.

@agirorn
Created November 24, 2021 10:24
Show Gist options
  • Save agirorn/34c4b95edac64c5e81a83c2812dd311b to your computer and use it in GitHub Desktop.
Save agirorn/34c4b95edac64c5e81a83c2812dd311b to your computer and use it in GitHub Desktop.
Skip a command on an Apple computer with M1 ARM-based CPU
#!/usr/bin/env bash
#
# Usage
#
# skip_in_m1 cmd [ARGS]
#
# example:
# skip_in_m1 echo "This is not an Apple computer with M1 ARM-based CPU"
CMD="$@"
echo $OSTYPE | grep -q darwin && uname -m | grep -q 'arm64';
if [[ $? == 0 ]]; then
printf "Skipping on Apple Mac with an M1 cpu: \"${CMD}\"\n"
exit 0
fi
eval "${CMD}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment