Last active
January 8, 2020 15:12
-
-
Save iboss-ptk/ebe6f4330d627fe74d2e8f5bf702963e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # usage ./js?.sh <word> | |
| WORD=$1 | |
| STATUS_CODE=$(curl -s -o /dev/null -I -w "%{http_code}" "https://www.npmjs.com/package/$WORD") | |
| if [ "$STATUS_CODE" == 200 ] | |
| then | |
| echo "Found \"$WORD\" js package. DRINK!" | |
| elif [ "$STATUS_CODE" == 404 ] | |
| then | |
| echo "\"$WORD\", js package not found." | |
| exit 1 | |
| else | |
| echo "failed with status code: $STATUS_CODE" | |
| exit 1 | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment