-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsendmeto
More file actions
executable file
·30 lines (27 loc) · 826 Bytes
/
sendmeto
File metadata and controls
executable file
·30 lines (27 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
RED=$(tput setaf 1)
GREEN=$(tput setaf 2)
YELLOW=$(tput setaf 3)
BLUE=$(tput setaf 4)
PINK=$(tput setaf 5)
BLACK=$(tput setaf 0)
NC=$(tput sgr0)
INFC="${YELLOW}"
set -e
user=`whoami`
host="$1"
address="$host"
# address="$user@$host"
sourceDir="./"
targetDir="~"
CURRENT_DIR=`pwd`
BASENAME=`basename "$CURRENT_DIR"`
# set -x # Used to preview all the commands called (good for DEBUG)
BASENAME="${BASENAME}$2"
rsync -avhr --dry-run --filter=":- .gitignore" --exclude='.*' $sourceDir $address:$targetDir/$BASENAME
#Ask
read -p "${PINK}Above will be ${GREEN}uploaded${PINK} to ${GREEN}$host:$targetDir/$BASENAME${PINK}. Press ENTER to continue.${NC}"
#Upload
rsync -avhr --filter=":- .gitignore" --exclude='.*' $sourceDir $address:$targetDir/$BASENAME
ssh -t $address "cd $targetDir/$BASENAME; bash --login"
exit 0;