Facebook
From ProxPxD, 9 Months ago, written in Bash.
Embed
Download Paste or View Raw
Hits: 97
  1. #AGH
  2. alias aghvpn='cd /home/proxpxd/Documents/proxpxd@student.agh.edu.pl.2019;ls |grep "__";sudo openvpn VPN-AGH.conf;cd ~'
  3. alias vpnagh='cd /home/proxpxd/Documents/proxpxd@student.agh.edu.pl.2019;ls |grep "__";sudo openvpn VPN-AGH.conf;cd ~'
  4. alias charon='ssh malipiot@charon.kis.agh.edu.pl'
  5. alias borg='ssh malipiot@borg.kis.agh.edu.pl'
  6.  
  7.  
  8. #my functions:
  9.  
  10. correctPath(){
  11.     if [[ ${1:0:${#HOME}} == $HOME ]]
  12.    then
  13.       partial=${1:${#HOME}:$((${#1} - ${#HOME}))}
  14.    else
  15.       partial="$1"
  16.    fi
  17.    corrected=""
  18.    for (( i=0; i<${#partial}; i++ )); do
  19.       if [[ ${partial:$i:1} != "/"  || $i -gt 2  ]]
  20.       then
  21.         corrected=$corrected${partial:i:1}
  22.       fi
  23.    done
  24.    echo "$corrected"
  25. }
  26. kp(){
  27.    corr=$(correctPath $2)
  28.    scp -r "$1" malipiot@"$3".kis.agh.edu.pl:"$corrected"
  29. }
  30. pk(){
  31.    corr=$(correctPath $1)
  32.    scp -r malipiot@"$3".kis.agh.edu.pl:"$corrected" $2
  33. }
  34. kpc(){
  35.    kp $1 $2 charon
  36. }
  37. kpb(){
  38.    kp $1 $2 borg
  39. }