Try file -L <library name> | grep shared
if this produces any output, the file is dynamically linked. Alternately you could do ldd <library name> | grep 'not a dynamic executable'
which produces output if it's static. Hope this answers your question, I would have added a comment to Aviator's answer, but I cannot comment (yet).
The -L
option to file forces files to dereference symlinks, which is not the default behavior if POSIXLY_CORRECT is not defined (as it is the case on my system).
Script example:
if [ -z "$(file -L | grep shared)" ]; then
echo "not a dynamic lib";
else
echo "dynamic lib";