Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

open remote file with local textmate (See related posts)

Run this on a remote server to open the file on your local map with ssh. Written by danp, I'm just saving this for a rainy day.

#!/bin/sh

host=`echo $SSH_CLIENT | cut -d' ' -f1`
path=`pwd | sed "s|^$HOME|/Volumes/chaos|"`
app="/Applications/TextMate.app"
file=$1

if [ ! -e $file ]; then
	echo -n "create $file? [Yn] "
	read input
	if [ -z "$input" -o "$input" = "Y" -o "$input" = "y" ]; then
		touch $file
	else
		exit
	fi
fi

ssh $host "open -a $app $path/$file; exit"

You need to create an account or log in to post comments to this site.


Click here to browse all 5140 code snippets

Related Posts