Last active
July 3, 2020 07:54
-
-
Save happypeter/4248241 to your computer and use it in GitHub Desktop.
upload my assets to the server
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
#!/usr/bin/env bash | |
sync_dryrun() | |
{ | |
echo | |
echo -e "\033[1m ...dryrun...\033[0m" | |
rsync -av --delete ~/happycasts/episodes/ peter@linode:~/media/assets/episodes/ --dry-run | |
echo -e "\033[1m ...dryrun...\033[0m" | |
echo | |
} | |
sync_dryrun | |
sync_server() | |
{ | |
echo | |
echo -e "\033[1m ...syncing...\033[0m" | |
rsync -av --progress --delete ~/happycasts/episodes/ peter@linode:~/media/assets/episodes/ | |
echo -e "\033[1m ...done...\033[0m" | |
echo | |
} | |
echo -n "Want to sync? (Y/n): " | |
read AAA | |
if [ "${AAA:-y}" = "y" ];then | |
sync_server | |
else | |
echo Nothing done, bye. | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
${AAA:-y}
这样 AAA 会有一个默认值y
。 好处是如果我直接敲回车,那么 sync_server 是会执行的。