+# Check if charfile exists
+CHARFILE="$CHARDIR/charfiles/$2"
+function existence() {
+ if [[ ! -f $CHARFILE ]]
+ then
+ missing_charfile
+ fi
+}
+
+# VERY basic syntax check
+function validity() {
+ if [[ $(grep , $CHARFILE && grep - $CHARFILE) ]]
+ then
+ echo "valid charfile"
+ else
+ existence
+ echo "invalid charfile"
+ exit 2
+ fi
+}
+
+# Look for arguments
+while getopts ":lchdv" arg
+do
+ case ${arg} in
+ h)
+ usage
+ exit 0
+ ;;
+ l)
+ list
+ exit 0
+ ;;
+ d)
+ readme
+ exit 0
+ ;;
+ v)
+ echo "charsel" $VERSION
+ exit 0
+ ;;
+ c)
+ validity
+ exit 0
+ ;;
+ ?)
+ echo "Invalid option"
+ usage
+ exit 3
+ ;;
+ :)
+ break
+ ;;
+ esac
+done
+shift $((OPTIND-1))
+
+# Redefine charfile and check file validity
+CHARFILE="$CHARDIR/charfiles/$1"
+existence
+validity