Created
September 29, 2015 17:27
-
-
Save mojaveazure/3687d0c8323f67788cee to your computer and use it in GitHub Desktop.
A function that checks the extension of a file
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 | |
# A function that checks the extension of a file | |
function checkExtension() { | |
FILE="$1" | |
EXTENSION="$2" | |
if [[ "${FILE: -4}" == "${EXTENSION}" ]] | |
then | |
echo yes | |
return 0 | |
else | |
echo no | |
return 1 | |
fi | |
} | |
export -f checkExtension |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment