sh Bash:goo.gl#使用Google URL Shortener服务(http://goo.gl)缩短网址。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了sh Bash:goo.gl#使用Google URL Shortener服务(http://goo.gl)缩短网址。相关的知识,希望对你有一定的参考价值。

#!/usr/bin/env bash
# Usage: goo.gl [URL]
#
# Shorten a URL using the Google URL Shortener service (http://goo.gl).
goo.gl() {
	[[ ! $1 ]] && { echo -e "Usage: goo.gl [URL]\n\nShorten a URL using the Google URL Shortener service (http://goo.gl)."; return; }
	curl -qsSL -m10 --connect-timeout 10 \
		'https://www.googleapis.com/urlshortener/v1/url' \
		-H 'Content-Type: application/json' \
		-d '{"longUrl":"'${1//\"/\\\"}'"}' |
		perl -ne 'if(m/^\s*"id":\s*"(.*)",?$/i) { print $1 }'
}

以上是关于sh Bash:goo.gl#使用Google URL Shortener服务(http://goo.gl)缩短网址。的主要内容,如果未能解决你的问题,请参考以下文章

sh 部署要求 - 适用:wget -O - https://goo.gl/Czw2tE | sudo bash

sh SSH - 将公钥从本地复制到服务器 - https://goo.gl/Ccaafo

html 修复Google Chrome自动播放政策。 https://goo.gl/xX8pDD

sh 在linux-amd64- wget -O上安装Helm - https://goo.gl/Y7GRN4 |庆典

Google App Invites:具有不同包名称/捆绑 ID 的 iOS 应用和 Android 应用 - 它们如何与 goo.gl/App Invites 关联?

goo.gl公司使用API和API密钥缩短URL-v2