bash script detect if ip address is correct
I'm not very good at bash scripts and I have searched google but can't find a script example that suits my needs.
I run a linux server and I test my WAN address with curl ifconfig.me. if the system is working correctly it gives me ip address (example) 11.22.33.44. but if its not working it gives me address (example) 99.88.77.66. I'm looking for a script that will run curl ifconfig.me and if it returns 11.22.33.44 it will no nothing and if it returns 99.88.77.66 it will execute a command. thanks for any pointers |
You're asking how do to an if statement in Bash?
You will find plenty of examples by searching (e.g.) "bash if statement" or you can go direct to the Conditional Constructs section of the Bash Manual. (It's probably also covered in the Bash FAQ.) |
Something like:
Code:
#!/bin/bash |
thankyou michaelk that script example has been a big help
|
All times are GMT -5. The time now is 06:26 AM. |