写一个 linux 脚本,两个参数,pattern、file,更改 host pattern 下的 identityfile file

写一个 linux 脚本,两个参数,pattern、file,更改 host pattern 下的 identityfile file

如: 执行命令

needed_script.sh "host_pattern" "~/.ssh/github"

Host host_pattern 
    HostName host_domain
    User username
    IdentityFile ~/.ssh/gitee
    IdentitiesOnly yes

Host host_pattern2 
    HostName host_domain
    User username
    IdentityFile ~/.ssh/gitee
    IdentitiesOnly yes

转换为

Host host_pattern 
    HostName host_domain
    User username
    IdentityFile ~/.ssh/github
    IdentitiesOnly yes

Host host_pattern2 
    HostName host_domain
    User username
    IdentityFile ~/.ssh/gitee
    IdentitiesOnly yes