Idiotically simple bash script problem.
Hi,
I'm using a dynamic IP address on one of my machines, but I need SSH access to it so I registered for a dynamic DNS name with dyndns.org. I was looking through the unofficial ubuntu guide, and they suggest that in order to keep upto date with the DNS records, to write a simple script to update the server. The script is as follows: Code:
USERNAME=myusername Code:
me@mymachine:/root$ sudo sh dyndns_update.sh Code:
me@mymachine:/root$ sudo sh -x dyndns_update.sh Could someone please help me? I'm not great with bash but I do know some basic scripting such as what is in my sig, and I've tried allsorts with this but to no avail. I know that the ipcheck.py commands work, and I get the exact same result if I echo these lines. Many Thanks in advance, |
Quote:
if [ -f /root/ipcheck.dat ] then no ; since it means new command and breaks the fi at the end |
I've already tried that, and just tried it again, with no difference.
I thought that a semi-colon was just a replacement for a new-line character, allowing you to maximise space and make more sense, by allowing you to execute the commands before the ; and then after. As BASH reads one line at a time and then executes what it found in the line - it doesn't go through executing each command as it finds it. |
It looks as if your script contains CR characters. Get rid of them, eg:
strings oldscript >newscript |
Quote:
then echo "You have beer! The fridge contains the following:" for i in $HOME/fridge/*beer do head -n 1 $i done else echo "You have no beer! I'll get some." fi this seems to work on mine :S |
carl0ski, that isn't what I'm having a problem with, that's my signature!
:p |
I think it can't find ipcheck.py - can you put the full path to those python scripts in and see what happens.
|
Hi guys, problem solved - in case anyone is interested, there is nothing wrong with the script itself. :scratch:
I moved it into /home/me/dyndns/ and changed the script accordingly, and now it seems to work fine! |
All times are GMT -5. The time now is 01:20 AM. |