Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Open Remote File With Local Textmate

DZone's Guide to

Open Remote File With Local Textmate

·
Free Resource
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"
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}