How to remove white spaces from the beginning an end of a string in unix?

Suppose, I have a variable var=" name is ".
I want to remove the blank spaces from the begining and endonly, not from the entire string.
So, that the variable/string looks like following
var="name is".
Please look after the issue.

hi,
If it is in variable , use echo to output the variable var.

a=" Test this "
echo $a
Test this

or something like this:

echo " value is " | sed -e 's/^ \(.*\) $/\1/'
var2=$(echo "$var" | { read x; echo "$x" ;})

bash/ksh93:

read var2<<<"$var"

set $var
var="$*"