There are two most commonly used ways to check the Slackware version.
The first one is the file /etc/slackware-version that shows the system version.
$ cat /etc/slackware-version
Slackware 15.0
The second method shows more detailed information about the system in this file /etc/os-release.
$ cat /etc/os-release
NAME=Slackware
VERSION="15.0"
ID=slackware
VERSION_ID=15.0
PRETTY_NAME="Slackware 15.0 x86_64"
ANSI_COLOR="0;34"
CPE_NAME="cpe:/o:slackware:slackware_linux:15.0"
HOME_URL="http://slackware.com/"
SUPPORT_URL="http://www.linuxquestions.org/questions/slackware-14/"
BUG_REPORT_URL="http://www.linuxquestions.org/questions/slackware-14/"
VERSION_CODENAME=stable
You can easily load the information from this file and use it in your shell script using the command source.
$ source /etc/os-release
$ echo "Distribution: $NAME"
Distribution: Slackware