Advertisement
Shuraken007

sh_aliases

May 18th, 2023
792
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.67 KB | None | 0 0
  1. host_sub_proxy () {
  2.    declare sub_args;
  3.    if [ -f $SCRIPT_DIR/host_sub.pl ]; then
  4.       sub_args=$(perl $SCRIPT_DIR/host_sub.pl $@);
  5.       [ $? != 0 ] && echo $sub_args && return 1;
  6.       echo "$sub_args"
  7.    fi
  8.    sub_args=$(echo $sub_args | tail -n1);
  9.    printf '%sOk? [y/n]%s ' \
  10.      "$FMT_YELLOW" "$FMT_RESET"
  11.    read -r opt
  12.    case $opt in
  13.      y*|Y*|"") eval "command $sub_args";;
  14.      n*|N*) echo "----------"; return ;;
  15.    esac
  16. }
  17.  
  18. ssh() {
  19.    host_sub_proxy ssh $@;
  20. }
  21. scp() {
  22.    host_sub_proxy scp $@;
  23. }
  24. ssh-copy-id() {
  25.    host_sub_proxy ssh-copy-id $@;
  26. }
  27. sshpass () {
  28.    host_sub_proxy sshpass $@;
  29. }
  30. rsync () {
  31.    host_sub_proxy rsync $@;
  32. }
  33.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement