Q:

When running bash script there is a logical error

So I have fixed my first issue with the script taking input but now no matter what letter I enter it only adds the numbers.
here is the code. any help would be greatly appreciated.
#!/bin/bash

add() {
        expr $x + $y
}

sub() {
        expr $x - $y
}

mult() {
        expr $x * $y
}

div() {
        expr $x / $y
}

 echo "Enter a for add, s for subtract, m for multiply or d for divide and 2 numbers"
read choice x y

 if [ $choice=="a" ]
 then
         add
 else
        if [ $choice == "s" ]
        then
                sub
        else
                if [ $choice == "m" ]
                then
                        mult
                else
                        if [ $choice == "d" ]
                        then
                                div

                        fi
                fi
        fi
fi

A:

It seems like you want to get x and y from first and second arguments ( $1 and $2 ) and to read the operation ( a, s, d, m ) from stdin.
I modified your code a bit, to overcome the problems in the original script and to provide the result based on my assumptions:
#!/bin/bash

# First number.
x=$1
# Second number.
y=$2
# Result of either addition, subtraction, division or multiplication of     $x and $y.
result=0

# Reads operation from user.
read -ep "Enter a for add, s for subtract, m for multiply or d for divide: " operation

case $operation in
    a) result=$(( x + y ));;
    s) result=$(( x - y ));;
    d) result=$(( x / y ));;
    m) result=$(( x * y ));;
    *) printf '%s: %s\n' "$operation" "Unknown operation" >&2; exit 1;;
esac

printf 'result: %s\n' "$result"

Usage example: ( script name is sof.sh )
./sof.sh 5 4
Enter a for add, s for subtract, m for multiply or d for divide: a
result: 9

./sof.sh 5 4
Enter a for add, s for subtract, m for multiply or d for divide: m
result: 20

./sof.sh 5 4
Enter a for add, s for subtract, m for multiply or d for divide: s
result: 1

./sof.sh 5 4
Enter a for add, s for subtract, m for multiply or d for divide: d
result: 1

P.S.
Please note the following:

expr is a program used in ancient shell code to do math. In POSIX shells like bash, use $(( expression )). In bash, ksh88+, mksh/pdksh, or zsh, you can also use (( expression )) or 'let 
            expression'.
Though not used originaly in the script, while programming in Bash it is worth knowing that [[ is a bash keyword similar to (but more powerful than) the [ command. See this Bash FAQ and Test and conditionals.
Unless you're writing for POSIX sh, it is recommended to use [[.

