Skip to content

Instantly share code, notes, and snippets.

@jplomas
Last active April 13, 2021 06:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jplomas/0fd17e51f2be1067a326e084ee666b4f to your computer and use it in GitHub Desktop.
Save jplomas/0fd17e51f2be1067a326e084ee666b4f to your computer and use it in GitHub Desktop.
Shell script to validate GMC number
#!/bin/sh
if [ $# -eq 0 ]; then
echo "No argument (GMC number) provided"
exit 1
fi
RES=$(cURL -s https://www.gmc-uk.org/doctors/$1 | grep -A2 "<div class=\"c-dr-details__status-description\">" | grep -E ' {20,}' | sed -e 's/^[ \t]*//')
if [ -z "$RES" ]; then
echo "Not found"
exit 1
else
echo $RES
fi
if [[ $RES == *"Not Registered"* ]]; then
exit 1
else
exit 0
fi
@jplomas
Copy link
Author

jplomas commented Apr 13, 2021

Updated with exit codes and correct shell specifier 🤦‍♂️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment