Created
March 9, 2019 02:12
-
-
Save mrahtz/4fb0306bfbc914290b5cefc76c3c5f20 to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/bash | |
set -o errexit | |
server=$1 | |
remote_paths="$server:\"" | |
for remote_path in "${@:2}"; do | |
remote_paths="$remote_paths '$remote_path'" | |
done | |
remote_paths="$remote_paths\"" | |
if test $(find ~/.tr_timestamp -atime -5s); then | |
exit | |
fi | |
touch ~/.tr_timestamp | |
to_dir=$(mktemp -d) | |
echo -n $to_dir | pbcopy | |
cmd="rsync -av $remote_paths '$to_dir' && open '$to_dir'" | |
script_name=$(mktemp) | |
echo $cmd > $script_name | |
bash_cmd="/bin/bash '$script_name'" | |
script="tell application \"iTerm2\" | |
create window with default profile command \"$bash_cmd\" | |
end tell" | |
osascript -e "$script" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment