---
title: "通过shell获取当前网络的出口IP地址（路由器外网IP）"
author: "fedora"
date: "2014-07-01T21:16:53Z"
tags: []
categories: ["编程语言"]
slug: "shell-ip-ip"
draft: false
lastmod: "2014-07-01T21:16:53Z"
id: 2087349
url: "https://fedora.iteye.com/blog/2087349"
---

#!/bin/sh

TS=$(echo $(curl -s 'http://20140507.ip138.com/ic.asp') | sed -rn 's/^.\*\\[()/\\1/p')

TIP=$(echo ${TS%]\*})

echo $TIP