Last active
December 27, 2015 19:19
-
-
Save shello/7376146 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
# Retrieves a remote file to a temporary local file, and prints its path | |
remotetmp() { | |
REMOTE_TMPFILE=`mktemp` | |
scp -q $1 $REMOTE_TMPFILE | |
if [[ $? == 0 ]]; then | |
print $REMOTE_TMPFILE; | |
fi | |
} | |
# Examples: | |
# $ remotetmp host:path/file | |
# Simple usage, retrives `path/file` from the host `host`, | |
# prints the path of the file | |
# $ diff `remotetmp host:path/file` path/file | |
# Compares a remote `path/file` in `host` with a local `path/file` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment