You have two options (see this StackOverflow answer [here][1]): - **Preferred:** Surround the invocation in `$()` - Surround the invocation in back ticks > NOTE: [back ticks are legacy][2], the former method is preferred. ```bash 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"; ``` [1]: https://stackoverflow.com/questions/8737638/assign-curl-output-to-variable-in-bash?rq=1 [2]: https://github.com/koalaman/shellcheck/wiki/SC2006