0

I'm trying to create a simple bash script to get the HTTP codes from CURL

So here is my code :

#!/bin/bash
AWKRESULT = $(curl -sL -w "result=%{http_code}" "http://192.168.8.69:8080/myReport/archive" -o "/tmp/reportlog" | awk -F= '{print $2}')
echo $AWKRESULT

the result of

curl -sL -w "result=%{http_code}" "http://192.168.8.69:8080/myReport/archive" -o "/tmp/reportlog" | awk -F= '{print $2}'

is 500.

However it's always has this result :

./test.sh[2]: AWKRESULT: not found.

any idea what am I missing?

Rudy
  • 7,008
  • 12
  • 50
  • 85

1 Answers1

2

Remove the spaces around the =:

AWKRESULT=$(...)
Sjoerd
  • 74,049
  • 16
  • 131
  • 175