Assign output to variable in Bash [duplicate]

I’m trying to assign the output of cURL into a variable like so:

#!/bin/sh
$IP=`curl automation.whatismyip.com/n09230945.asp`
echo $IP
sed s/IP/$IP/ nsupdate.txt | nsupdate

However, when I run the script the following happens:

./update.sh: 3: =[my ip address]: not found

How can I get the output into $IP correctly?

2 Answers
2

Leave a Comment