Q:

Bash script, returns awk: can't open file ~/.ssh/config

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

A:

In quotes bash does not expand ~. I suggest to use $HOME:
ssh_config_path="$HOME/.ssh/config"

