Skip to content

Instantly share code, notes, and snippets.

@kushal-r
Created December 15, 2020 19:01
Show Gist options
  • Select an option

  • Save kushal-r/a433ac713401263adae699015dd6d5b7 to your computer and use it in GitHub Desktop.

Select an option

Save kushal-r/a433ac713401263adae699015dd6d5b7 to your computer and use it in GitHub Desktop.
gen_remote_host() {
case $1 in
"thor") r_host="10.189.50.0"
user_name="thor"
;;
"loki") r_host="10.189.16.251"
user_name="loki"
;;
esac
}
cp2 () {
local r_host user_name
local src dest
src=$2
if [[ -z "$3" ]];
then dest="~/"
else dest=$3
fi
gen_remote_host $1
echo scp "$src" "$user_name"@"$r_host":"$dest"
scp "$src" "$user_name"@"$r_host":"$dest"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment