Announcement

Collapse
No announcement yet.

BASH syntax error: unexpected end of file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • BASH syntax error: unexpected end of file

    I have the following little bash script attempting to tell me if my ISP has altered my IP address.
    Code:
    #!/bin/bash getip=" "; $getip=$(/usr/bin/dig +short myip.opendns.com @resolver1.opendns.com); if [[ $getip==" " ]]; then echo "Currently offline but ip address is $gotip" > /media/ramdisk/message.txt; else if [[ "$getip" != "$gotip" ]]; then gotip=$(cat /home/alf/gotip.txt); echo "ip address was $gotip is now $getip" > /media/ramdisk/message.txt; echo $getip > /home/alf/gotip.txt; fi /usr/bin/mail -s "IpChanged for $(uname -n)" alf@stockton.co.za < /media/ramdisk/message.txt; exit 1
    when I run it I get :- Unexpected end of file error – Bash Script / Shell Syntax Error
    Code:
    /home/alf/Develop/bash/IpChanged.sh: line 3: =41.145.54.222: command not found /home/alf/Develop/bash/IpChanged.sh: line 14: syntax error: unexpected end of file
    Please tell me what I have done wrong.
Working...
X