mac 下载使用sshpass+命令起别名

1.下载homebrew

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

2.创建 sshpass.rb 文件

require 'formula'

class Sshpass < Formula
  url 'http://sourceforge.net/projects/sshpass/files/sshpass/1.06/sshpass-1.06.tar.gz'
  homepage 'http://sourceforge.net/projects/sshpass'
  sha256 'c6324fcee608b99a58f9870157dfa754837f8c48be3df0f5e2f3accf145dee60'

  def install
    system "./configure", "--disable-debug", "--disable-dependency-tracking",
                          "--prefix=#{prefix}"
    system "make install"
  end

  def test
    system "sshpass"
  end
end

3.在sshpass.rb的同目录下执行安装命令

brew install sshpass.rb

命令起别名

mac

vim ~/.bash_profile
alias ymq='sshpass -p r00tme ssh [email protected]'
source ~/.bash_profile

linux

vim ~/.bashrc
alias auth='代替带的命令'
source ~/.bashrc

你可能感兴趣的:(macos,linux,运维)