使用Python(这项工作的最佳工具,IMHO):
原文链接:https://www.f2er.com/bash/385366.html#!/usr/bin/env python import os from urlparse import urlparse uri = os.environ['NAUTILUS_SCRIPT_CURRENT_URI'] result = urlparse(uri) user,host = result.netloc.split('@') path = result.path print('user=',user) print('host=',host) print('path=',path)
进一步阅读: