addalias script

#!/bin/bash
# Set in .bash_aliases with: alias addalias='~/alias.sh'
# Ask the user for the alias name they want to use
echo "Enter the alias name:"
read user_alias

# Replace the alias_name variable in the alias command with the user's input
alias_cmd="alias $user_alias='ssh username@$user_alias.company.com'"

# Append the alias command to the end of the .bash_aliases file
if [ -f ~/.bash_aliases ]; then
  echo "$alias_cmd" >> ~/.bash_aliases
  echo "Alias added to ~/.bash_aliases"
else
  echo "Error: ~/.bash_aliases file not found"
fi