Reputation: 9825
I'm able to awk this file directly from the command line but when I try to use it from my script it breaks. Not sure why. Heres my script
#!/bin/bash
ssh_config_path="~/.ssh/config"
echo -n "Enter the username of the account you'd like to switch to > "
read username
awk '
!x{x=sub(/github-secondary/,"github.com")}
!y{y=sub(/github\.com/,"github-secondary")}
1' $ssh_config_path
Upvotes: 0
Views: 2560
Reputation: 88684
In quotes bash does not expand ~
. I suggest to use $HOME
:
ssh_config_path="$HOME/.ssh/config"
Upvotes: 1