You can try the stat
command. To assign the output of a command to a variable, you can do "command substitution". In Bash the syntax is var=$(command) but often you will see back ticks - as in var=`command`.
In brief, to assign file size to a variable you can do something like
size=$(stat -c %s filename)
see man stat