You have two options (see this StackOverflow answer here):
- Preferred: Surround the invocation in
$() - Surround the invocation in back ticks
NOTE: back ticks are legacy, the latterformer method is preferred.
output=$(curl -I http://google.com | head -n 1| cut -d $' ' -f2) echo "$output"; output=`curl -I http://google.com | head -n 1| cut -d $' ' -f2` echo "$output";