骆言 2022-10-12 22:44 采纳率: 91.7%
浏览 12
已结题

写一个 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
  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 系统已结题 10月20日
    • 创建了问题 10月12日