My line of code is :
while IFS= read -r line
do
echo "$line"
echo "**"
CURL_REQ=$(curl -is "${line}" -H 'Pragma: akamai-x-get-extracted-values' | grep 'AKA_PM_PROPERTY_NAME')
echo "$line"
echo "$CURL_REQ"
After doing some trial an error, I now understood that inside variable declaration of "CURL_REQ" ${line} is not being recognized. However the echo "$line" is working perfectly without any issues outside the variable declaration.
When I replace "${line}" with a static hostname, the curl works fine and I can see the value on echo "$CURL_REQ"
Reproducible example :
#!/bin/bash
INPUT_FILE="/domain.txt"
EXPECTED_HEADER="AKA_PM_PROPERTY_NAME"
declare -i COUNT=1
echo "*************************************************************************"
while IFS= read -r line
do
CURL_REQ=$(curl -is ${line} -H 'Pragma: akamai-x-get-extracted-values' | grep 'AKA_PM_PROPERTY_NAME')
echo "$line"
echo $CURL_REQ
PROP_VALUE=$(echo ${CURL_REQ} | cut -c 51-)
echo $PROP_VALUE
done < "$INPUT_FILE"
Input file domain.txt should contain the lines below :
myntra.com ndtv.com