使用Python(这项工作的最佳工具,IMHO):
#!/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)
进一步阅读: