I fear I am going to have to restructure this entirely, but can anyone tell me why this used to work and now it does not in the latest Macos BASH?
Works: GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16)
Does Not Work: GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18)
urlfile="$1"
IFS=$(echo -e '\n')
while IFS= \
read -r var1; \
read -r var2
do
curl -g --request POST \
--url https://website.com/urlLookup \
--header 'Content-Type: application/json' \
--header 'cache-control: no-cache' \
--data '[
"'"$var1"'",
"'"$var2"'"]' \
--cookie newcookies.txt
sleep 10
echo " "
done <"$urlfile"
The set -x
shows the error and it looks like it might be a be a BASH bug. The variable has an accept-line "\C-M/"included in it.
curl -g --request POST --url https://replaced.com/urlLookup --header 'Content-Type: application/json' --header 'cache-control: no-cache' --data $'["art.com\C-M/"]' --cookie newcookies.txt
I have tried every combination I can think of... The format has to be '["art.com"]'
for it to be accepted. The single quotes have to be there or the variable is not populated... '['"$var1"']'
, but as soon as this is done the accept line shows up.