0

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
Cyrus
  • 84,225
  • 14
  • 89
  • 153
Daniel Kobe
  • 9,376
  • 15
  • 62
  • 109

1 Answers1

1

In quotes bash does not expand ~. I suggest to use $HOME:

ssh_config_path="$HOME/.ssh/config"
Cyrus
  • 84,225
  • 14
  • 89
  • 153