Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- extract_file () {
- sed -n '/^ ip address /{s/^ ip address \([^ ]*\) .*/\1/;p;q;}'
- }
- extract_dns () {
- dig +short "$1" | head -n 1
- }
- if [ $(extract_file <e.txt) == $(extract_dns "hostname.org") ]; then
- ./vpn2.sh
- fi
- andrea@andypc:~$ sh -x ee.sh
- + extract_file
- + sed -n /^ ip address /{s/^ ip address \([^ ]*\) .*/\1/;p;q;}
- + extract_dns dfg1.no-ip.org
- + dig +short dfg1.no-ip.org
- + head -n 1
- + [ 79.1.134.136 == 79.1.134.136 ]
- [: 1: 79.1.134.136: unexpected operator
- andrea@andypc:~$
Add Comment
Please, Sign In to add comment