please wrap code with code tag! ([ code ] [ /code ] without space in bracket
Quote:
Originally Posted by SAYAYINX
|
yes, this works, but this work better:
Code:
curl -s http://www.ipchicken.com/ | awk '/[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*/ {print $1}' | uniq
Quote:
Originally Posted by SAYAYINX
But I have another question:
LOG=/your/log/path/ip <= where is that folder? can i make one up?
OLD_IP=`cat $LOG` <= again, is that a folder? a file?
|
you should create the folder and enter full path here.
i have a 'scrpts' folder in my home director. and save log file with a 'log_' prefix with script name there.
ex:
script: /home/ali/scripts/ip_change
log file: /home/ali/scripts/log_ip_change
i have assigned the log file path to LOG variable in script, the in used 'LOG' variable as parameter to 'cat' command to read file content and assigned the result to 'OLD_IP' variable.
you just need to define 'LOG' variable. the LOG variable points to a file.