In shell, you don’t put a $ in front of a variable you’re assigning. You only use $IP when you’re referring to the variable.
#!/bin/bash
IP=$(curl automation.whatismyip.com/n09230945.asp)
echo "$IP"
sed "s/IP/$IP/" nsupdate.txt | nsupdate
More Related Contents:
- How to urlencode data for curl command?
- How to properly handle a gzipped page when using curl?
- How to include an ‘&’ character in a bash curl statement
- Percent sign % not working in crontab
- Script to get the HTTP status code of a list of urls?
- curl: argument list too long
- Save file to specific folder with curl command
- Why should there be spaces around ‘[‘ and ‘]’ in Bash?
- Capturing multiple line output into a Bash variable
- Bash tool to get nth line from a file
- How can I use inverse or negative wildcards when pattern matching in a unix/linux shell?
- How to get a password from a shell script without echoing
- Exit Shell Script Based on Process Exit Code [duplicate]
- How can I use Bash syntax in Makefile targets?
- How do I pass in the asterisk character ‘*’ in bash as arguments to my C program?
- Delete files older than 10 days using shell script in Unix [duplicate]
- Remove Unicode characters from textfiles – sed , other Bash/shell methods
- How to replace an entire line in a text file by line number
- Simulating ENTER keypress in bash script
- Piping both stdout and stderr in bash?
- Why aliases in a non-interactive Bash shell do not work
- How to run some command before or after every Bash command entered from console?
- What is your single most favorite command-line trick using Bash? [closed]
- How to parse $QUERY_STRING from a bash CGI script?
- Read a file by bytes in BASH
- How can I print each command before executing? [duplicate]
- Using Bash to display a progress indicator (spinner) [duplicate]
- Can parameter expansion be nested in Bash? [duplicate]
- Difference between wait and sleep
- How to get the first line of a file in a bash script?