title: How can I make a chat script in bash?
body: <p>I want to make a chat script in bash and I've started out pretty basic and you start off by login in with any name you want, no password required and then you can write commands like connect, clear, exit and so on.</p>
  
  <p>But I want to be able to actually start a chat between two people in the terminal window. Now, I've read a little about IRC but I don't know how to get it to work.</p>
  
  <p>Any help would be appreciated</p>
  
  <p>Here's my script:</p>
  
  <pre><code>#!/bin/bash
  ver=1.0
  my_ip="127.0.0.1"
  
  function connect()
  {
  
  echo -n "Ip-address: "
  read ip
  
  if [ -n "$ip" ]
  then
  
  exit
  
  fi    
  
  }
  
  function check()
  {
  
      if [ "${c}" = "connect" ] || [ "${c}" = "open" ]
      then
  
      connect
  
      fi
  
      if [ "${c}" = "clear" ] || [ "${c}" = "cls" ]
      then
  
      clear
      new
  
      fi
  
      if [ "${c}" = "quit" ] || [ "${c}" = "exit" ]
      then
  
      echo "[Shutdown]"
      exit
  
      fi
  
  }
  
  function new()
  {
  
      echo -n "$: "
      read c
  
      if [ -n "${c}" ]
      then
  
      check
  
      else
  
      echo "Invalid command!"
      new
  
      fi
  
  }
  
  function onLogin()
  {
  
  clear
  echo "Logged in as ${l_name} on [${my_ip}]"
  new
  
  }
  
  function login()
  {
  
  echo -n "Login: "
  read l_name
  
  if [ -n "${l_name}" ]
  
  then
  onLogin
  
  else
  
  echo "Invalid input!"
  login
  
  fi
  
  }
  
  
  #execution
  clear
  echo "Bash Chat v${ver} | Mac"
  login
  </code></pre>