Skip to main content

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"; 

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 latter 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"; 

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 former 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"; 
Note that backticks are legacy, not preferred
Source Link
Olivia Stork
  • 4.8k
  • 5
  • 30
  • 40

You have two options (see this StackOverflow answer here):

  • Preferred: Surround the invocation in back ticks$()
  • Surround the invocation in $()back ticks

NOTE: back ticks are legacy, the latter method is preferred.

output=`curloutput=$(curl -I http://google.com | head -n 1| cut -d $' ' -f2`f2) echo "$output"; output=$(curloutput=`curl -I http://google.com | head -n 1| cut -d $' ' -f2)f2` echo "$output"; 

You have two options (see this StackOverflow answer here):

  • Surround the invocation in back ticks
  • Surround the invocation in $()
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"; 

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 latter 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"; 
Clearer formatting
Source Link
Olivia Stork
  • 4.8k
  • 5
  • 30
  • 40

You have two options (see this StackOverflow answer You have two optionshere. Surrounding the invocation in back ticks or $(), like so):

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) 
  • Surround the invocation in back ticks
  • Surround the invocation in $()
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"; 

You have two options. Surrounding the invocation in back ticks or $(), like so:

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) 

You have two options (see this StackOverflow answer here):

  • Surround the invocation in back ticks
  • Surround the invocation in $()
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"; 
Source Link
user3920237
user3920237
Loading